proccreate race
This commit is contained in:
parent
1c8159def5
commit
803292c631
1 changed files with 3 additions and 1 deletions
|
|
@ -171,13 +171,15 @@ threadcreate(void (*fn)(void*), void *arg, uint stack)
|
||||||
int
|
int
|
||||||
proccreate(void (*fn)(void*), void *arg, uint stack)
|
proccreate(void (*fn)(void*), void *arg, uint stack)
|
||||||
{
|
{
|
||||||
|
int id;
|
||||||
_Thread *t;
|
_Thread *t;
|
||||||
Proc *p;
|
Proc *p;
|
||||||
|
|
||||||
p = procalloc();
|
p = procalloc();
|
||||||
t = _threadcreate(p, fn, arg, stack);
|
t = _threadcreate(p, fn, arg, stack);
|
||||||
|
id = t->id; /* t might be freed after _procstart */
|
||||||
_procstart(p, scheduler);
|
_procstart(p, scheduler);
|
||||||
return t->id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue