X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/47c4e0c19ae8526b14ce4e0d7b243f7a4dc6fafd..bffa3430fbbaaad29bec0b5bee9c1f0bfc7fd068:/lunaix-os/includes/lunaix/process.h?ds=sidebyside diff --git a/lunaix-os/includes/lunaix/process.h b/lunaix-os/includes/lunaix/process.h index faca284..86e485e 100644 --- a/lunaix-os/includes/lunaix/process.h +++ b/lunaix-os/includes/lunaix/process.h @@ -45,9 +45,12 @@ #define PS_GrDT (PS_TERMNAT | PS_DESTROY) #define PS_Rn (PS_RUNNING | PS_CREATED) -#define proc_terminated(proc) (((proc)->state) & PS_GrDT) -#define proc_hanged(proc) (((proc)->state) & PS_BLOCKED) -#define proc_runnable(proc) (!(proc)->state || !(((proc)->state) & ~PS_Rn)) +#define proc_terminated(proc) \ + (!(proc) || ((proc)->state) & PS_GrDT) +#define proc_hanged(proc) \ + ((proc) && ((proc)->state) & PS_BLOCKED) +#define proc_runnable(proc) \ + ((proc) && (!(proc)->state || !(((proc)->state) & ~PS_Rn))) #define TH_DETACHED 0b00000001 @@ -367,6 +370,7 @@ spawn_kthread(ptr_t entry) { assert(th); start_thread(th, entry); + detach_thread(th); } void