mirror of
https://github.com/janet-lang/janet
synced 2025-02-09 13:30:00 +00:00
Remove WNOWAIT code on linux.
Would cause os/proc-wait to block in some circumstances.
This commit is contained in:
parent
9dc03adfda
commit
ab068cff67
@ -470,15 +470,7 @@ static int proc_get_status(JanetProc *proc) {
|
|||||||
/* Function that is called in separate thread to wait on a pid */
|
/* Function that is called in separate thread to wait on a pid */
|
||||||
static JanetEVGenericMessage janet_proc_wait_subr(JanetEVGenericMessage args) {
|
static JanetEVGenericMessage janet_proc_wait_subr(JanetEVGenericMessage args) {
|
||||||
JanetProc *proc = (JanetProc *) args.argp;
|
JanetProc *proc = (JanetProc *) args.argp;
|
||||||
#ifdef WNOWAIT
|
|
||||||
pid_t result;
|
|
||||||
int status = 0;
|
|
||||||
do {
|
|
||||||
result = waitpid(proc->pid, &status, WNOWAIT);
|
|
||||||
} while (result == -1 && errno == EINTR);
|
|
||||||
#else
|
|
||||||
args.tag = proc_get_status(proc);
|
args.tag = proc_get_status(proc);
|
||||||
#endif
|
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,11 +481,7 @@ static void janet_proc_wait_cb(JanetEVGenericMessage args) {
|
|||||||
janet_ev_dec_refcount();
|
janet_ev_dec_refcount();
|
||||||
JanetProc *proc = (JanetProc *) args.argp;
|
JanetProc *proc = (JanetProc *) args.argp;
|
||||||
if (NULL != proc) {
|
if (NULL != proc) {
|
||||||
#ifdef WNOWAIT
|
|
||||||
int status = proc_get_status(proc);
|
|
||||||
#else
|
|
||||||
int status = args.tag;
|
int status = args.tag;
|
||||||
#endif
|
|
||||||
proc->return_code = (int32_t) status;
|
proc->return_code = (int32_t) status;
|
||||||
proc->flags |= JANET_PROC_WAITED;
|
proc->flags |= JANET_PROC_WAITED;
|
||||||
proc->flags &= ~JANET_PROC_WAITING;
|
proc->flags &= ~JANET_PROC_WAITING;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user