plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit 803292c631c8e80a0596a011a901e72c8e0e0edc
parent 1c8159def559fc9bcf5070d90901c84f996ab59a
Author: rsc <devnull@localhost>
Date:   Tue, 18 Jan 2005 20:53:12 +0000

proccreate race

Diffstat:
Msrc/libthread/thread.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libthread/thread.c b/src/libthread/thread.c @@ -171,13 +171,15 @@ threadcreate(void (*fn)(void*), void *arg, uint stack) int proccreate(void (*fn)(void*), void *arg, uint stack) { + int id; _Thread *t; Proc *p; p = procalloc(); t = _threadcreate(p, fn, arg, stack); + id = t->id; /* t might be freed after _procstart */ _procstart(p, scheduler); - return t->id; + return id; } void