diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-10-12 00:49:12 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-10-12 00:49:12 +0000 |
commit | 07608c768faadfe960872d492d960be3112b7999 (patch) | |
tree | dd98f9f231519dcc6a5f2b78164af83a50f851e6 /sys/src/libthread/create.c | |
parent | 24bd67f990fde5f25783293f57f651c93ce19125 (diff) |
libthread: deal with _schedfork() and _schedexec() returning -1
The current behaviour of the kernel to deadlock itself
instead of returning an error on fork.
This might change in the future, so prepare libthread
to handle this case.
For _schedfork(), we'r going to just retry forking
on every switch, while for _schedexec(), the exec
will fail and send ~0 down the pid channel.
Diffstat (limited to 'sys/src/libthread/create.c')
-rw-r--r-- | sys/src/libthread/create.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/src/libthread/create.c b/sys/src/libthread/create.c index 41a373c99..c58e6a837 100644 --- a/sys/src/libthread/create.c +++ b/sys/src/libthread/create.c @@ -97,7 +97,8 @@ procrfork(void (*f)(void *), void *arg, uint stacksize, int rforkflag) int id; p = _threadgetproc(); - assert(p->newproc == nil); + while(p->newproc) + _sched(); p->newproc = _newproc(f, arg, stacksize, nil, p->thread->grp, rforkflag); id = p->newproc->threads.head->id; _sched(); |