diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libthread/thread.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libthread/thread.c b/src/libthread/thread.c index b154ce6e..ff22bbaa 100644 --- 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 |