tproccreate race - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 803292c631c8e80a0596a011a901e72c8e0e0edc
(DIR) parent 1c8159def559fc9bcf5070d90901c84f996ab59a
(HTM) Author: rsc <devnull@localhost>
Date: Tue, 18 Jan 2005 20:53:12 +0000
proccreate race
Diffstat:
M src/libthread/thread.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/src/libthread/thread.c b/src/libthread/thread.c
t@@ -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