License
BSD-3-Clause
Advanced Process Control Features
This module provides advanced process control functionality that goes beyond basic monitoring, leveraging D's unique capabilities for system programming.
Features:
Process priority levels
Process monitoring event types
Process monitoring event
Process monitor callback type
Process monitor for event-driven notifications.
This class provides functionality to monitor process events and invoke callbacks when specific events occur.
Example:
auto monitor = new ProcessMonitor();
monitor.onProcessCreated((event) {
writeln("New process: ", event.pid);
});
monitor.start();private ProcessCallback _onCreatedprivate ProcessCallback _onTerminatedprivate ProcessCallback _onStatusChangedprivate Thread _monitorThreadprivate bool _runningprivate Duration _intervalvoid onProcessCreated(ProcessCallback callback) @safe nothrowSets callback for process creation events.void onProcessTerminated(ProcessCallback callback) @safe nothrowSets callback for process termination events.void onProcessStatusChanged(ProcessCallback callback) @safe nothrowSets callback for process status change events.this()Creates a new process monitor.void setProcessPriority(int pid, ProcessPriority priority) @trustedSets process priority/nice value.void setEnvironmentVar(string key, string value) @trusted nothrowSets an environment variable for a process.void removeEnvironmentVar(string key) @trusted nothrowRemoves an environment variable from the current process.ProcessMonitor monitorProcess(int pid, ProcessCallback callback,
Duration interval = 100.msecs) @safeConvenience function to monitor a single process.