CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
processobj.h
Go to the documentation of this file.
1
5
6#pragma once
7// This header file is auto-generated!
8// Do not make changes to this file or they will be overwritten.
9// clang-format off
10#include <cx/obj.h>
11#include <cx/struct.h>
12#include <cx/closure/closure.h>
13#include <cx/container/sarray.h>
14#include <cx/thread/atomic.h>
15#include <cx/thread/mutex.h>
16
17CX_C_BEGIN
18
19typedef struct Process Process;
20typedef struct Process_WeakRef Process_WeakRef;
22saDeclarePtr(Process_WeakRef);
23#define _sti_Process _sti_object
24#define SType_Process Process*
25#define STStorageType_Process Process*
26#define STypeArg_Process(type, val) stgeneric(object, (ObjInst*)objInstCheckClass(Process, val))
27#define STypeArgPtr_Process(type, val) (stgeneric*)objInstCheckClassPtr(Process, val)
28#define STypeCheckedArg_Process(type, val) stType(type), stArg(type, val)
29#define STypeCheckedPtrArg_Process(type, val) stType(type), stArgPtr(type, val)
30
31
32
37typedef struct Process {
38 union {
39 ObjIface* _;
40 void* _is_Process;
41 void* _is_ObjInst;
42 };
43 ObjClassInfo* _clsinfo;
44 atomic(uintptr) _ref;
45 atomic(ptr) _weakref;
46
47 int64 pid;
48 int64 starttime;
53 bool ischild;
58 atomic(bool) exited;
59 int32 exitcode;
60 int32 termsignal;
66 int64 watchid;
67 string name;
68 string exepath;
70 sa_closure onexit;
71} Process;
72extern ObjClassInfo Process_clsinfo;
73#define Process(inst) objInstCheckClass(Process, inst)
74#define ProcessNone ((Process*)NULL)
75
76typedef struct Process_WeakRef {
77 union {
78 ObjInst* _inst;
79 void* _is_Process_WeakRef;
80 void* _is_ObjInst_WeakRef;
81 };
82 atomic(uintptr) _ref;
83 RWLock _lock;
84} Process_WeakRef;
85#define Process_WeakRef(inst) objWeakRefCheckClass(Process, inst)
86
87
88CX_C_END
Atomic operations.
Basic closure functionality.
#define saDeclarePtr(name)
Definition sarray.h:100
CX Struct System - Introspectable, serializable POD structures in C.
Mutex synchronization primitive.
CX Object System - Object-oriented programming in C.
Dynamic arrays with type-safe generic programming.
Definition mutex.h:60
string exepath
Cached, best-effort.
Definition processobj.h:68
atomic(bool) exited
Set once the outcome is known and cached in the two fields below.
sa_closure onexit
Exit subscribers, fired once outside the lock.
Definition processobj.h:70
int32 exitcode
Valid once exited is set; PROC_ExitCodeUnknown if statusknown is false.
Definition processobj.h:59
Mutex lock
Guards publication of the exit state.
Definition processobj.h:69
int32 termsignal
Unix: signal that killed it, 0 if it exited normally.
Definition processobj.h:60
string name
Cached, best-effort.
Definition processobj.h:67
int64 pid
OS process id.
Definition processobj.h:47
int64 starttime
Definition processobj.h:48
bool statusknown
Definition processobj.h:61
int64 watchid
Exit watcher registration id, 0 if never registered.
Definition processobj.h:66
bool ischild
cx forked this process, so cx is responsible for reaping it
Definition processobj.h:53