|
VLink
2.0.0
A high-performance communication middleware
|
Portable child-process driver with asynchronous I/O notifications. 更多...
#include <cstdint>#include <memory>#include <string>#include <unordered_map>#include <vector>#include "./functional.h"#include "./macros.h"类 | |
| class | vlink::Process |
| Owns and drives a single child process with asynchronous I/O reporting. 更多... | |
命名空间 | |
| vlink | |
Portable child-process driver with asynchronous I/O notifications.
vlink::Process spawns a single child program at a time and exposes a QProcess-style surface for inspecting its lifecycle, reading captured output, writing to its standard input, and triggering termination. Output capture, exit notification, and timer-driven polling all run on an internal monitor thread.
Capability groups exposed by the class:
| Group | Representative members |
|---|---|
| Lifecycle | start, start_command, terminate, kill, close |
| Process metadata | get_process_id, get_state, get_error, get_exit_code |
| Environment & cwd | set_environment, set_inherit_environment, set_working_directory |
| I/O routing | set_process_mode, get_process_mode |
| stdout/stderr capture | read_line_stdout, read_all, bytes_available_stdout |
| stdin writing | write, close_write_channel |
| Async notifications | register_finished_callback, register_ready_read_stdout_callback |
| Synchronous waits | wait_for_started, wait_for_finished, wait_for_ready_read |
| Static helpers | execute, start_detached |
I/O channel routing modes:
| Mode | stdout | stderr |
|---|---|---|
kSeparateMode | Buffered pipe | Buffered pipe |
kMergedMode | Buffered pipe | Merged into stdout |
kForwardedMode | Inherits parent | Inherits parent |
kForwardedOutputMode | Inherits parent | Buffered pipe |
kForwardedErrorMode | Buffered pipe | Inherits parent |
SIGTERM, drains pending I/O, then optionally escalates to SIGKILL after kDestructorWaitTimeoutMs (5000 ms) before joining.