13 #ifndef __PROCESS_WINDOWS_JOBOBJECT_HPP__ 14 #define __PROCESS_WINDOWS_JOBOBJECT_HPP__ 31 #include <glog/logging.h> 45 const std::wstring&
name,
48 jobs.emplace(pid, JobData{
name, handle});
57 CHECK(!exit_code.isPending());
58 CHECK(!exit_code.isDiscarded());
61 CHECK(!killJobResult.isError())
62 <<
"Failed to kill job object: " << killJobResult.error();
76 std::map<pid_t, JobData> jobs;
104 if (handle.isError()) {
105 return Error(handle.error());
110 if (result.isError()) {
111 return Error(result.error());
130 #endif // __PROCESS_WINDOWS_JOBOBJECT_HPP__ Definition: nothing.hpp:16
Definition: errorbase.hpp:36
T & get()&
Definition: try.hpp:80
Definition: windows.hpp:72
process::Future< bool > cleanup(const std::string &hierarchy)
void cleanup(Future< Option< int >> exit_code, const pid_t pid)
Definition: jobobject.hpp:55
Definition: process.hpp:72
Future< Option< int > > reap(pid_t pid)
Try< std::wstring > name_job(pid_t pid)
Definition: jobobject.hpp:39
Try< Nothing > assign_job(SharedHandle job_handle, pid_t pid)
Definition: jobobject.hpp:351
DWORD pid_t
Definition: windows.hpp:181
virtual ~JobObjectManager()
Definition: jobobject.hpp:41
Try< SharedHandle > create_job(const std::wstring &name)
Definition: jobobject.hpp:85
const Future< T > & onAny(AnyCallback &&callback) const
Definition: future.hpp:1442
Try< Nothing > kill_job(SharedHandle job_handle)
Definition: jobobject.hpp:381
Definition: jobobject.hpp:37
static Try error(const E &e)
Definition: try.hpp:43
void dispatch(const UPID &pid, std::unique_ptr< lambda::CallableOnce< void(ProcessBase *)>> f, const Option< const std::type_info * > &functionType=None())
A "process identifier" used to uniquely identify a process when dispatching messages.
Definition: pid.hpp:289
Definition: attributes.hpp:24
bool isError() const
Definition: try.hpp:78
Definition: executor.hpp:48
JobObjectManager()
Definition: jobobject.hpp:40
PID< JobObjectManager > job_object_manager
A hook can be passed to a subprocess call.
Definition: subprocess.hpp:153
Definition: process.hpp:505
Deferred< void()> defer(const PID< T > &pid, void(T::*method)())
Definition: defer.hpp:35
void manage(const pid_t pid, const std::wstring &name, const SharedHandle &handle)
Definition: jobobject.hpp:43
constexpr const char * name
Definition: shell.hpp:41
Definition: future.hpp:58