feat(SystemAsync): add async IO ProcessManager/communicate and shared WatcherService with WatchSubscription (M-SYSTEM-03, M-SYSTEM-04)
This commit is contained in:
1 parent
fcdbc063b2
commit
9a3c5d86ef
9 files changed
+2062
No files matched your search
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 4.0)
|
||||
project(VoidSystemAsyncOnlyConsumer LANGUAGES CXX)
|
||||
|
||||
find_package(Void CONFIG REQUIRED COMPONENTS SystemAsync)
|
||||
|
||||
add_executable(void_system_async_only_consumer main.cpp)
|
||||
target_link_libraries(void_system_async_only_consumer PRIVATE Void::SystemAsync)
|
||||
target_compile_features(void_system_async_only_consumer PRIVATE cxx_std_26)
|
||||
|
||||
enable_testing()
|
||||
add_test(NAME SystemAsyncOnlyConsumer COMMAND void_system_async_only_consumer)
|
||||
@@ -0,0 +1,21 @@
|
||||
#include <Void/Async/Executor.hpp>
|
||||
#include <Void/IO/Driver.hpp>
|
||||
#include <Void/System/AsyncProcess.hpp>
|
||||
#include <Void/System/AsyncWatcher.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
Void::Async::ManualExecutor exec;
|
||||
auto drv = Void::IO::Driver::create(exec);
|
||||
if (!drv.has_value()) {
|
||||
return 1;
|
||||
}
|
||||
Void::SystemAsync::ProcessManager mgr{**drv, exec};
|
||||
Void::SystemAsync::WatcherService watcher{exec};
|
||||
if (mgr.active_children() != 0 || watcher.watch_count() != 0) {
|
||||
return 2;
|
||||
}
|
||||
(void)watcher.shutdown();
|
||||
(void)(*drv)->shutdown_and_join();
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user