libthread: fix fault in teardown of proc

Fixes #332.
This commit is contained in:
Russ Cox 2020-01-13 23:26:26 -05:00
parent 573169dd88
commit 481b596d93
2 changed files with 2 additions and 1 deletions

View file

@ -429,6 +429,7 @@ Out:
unlock(&p->lock); unlock(&p->lock);
_threadsetproc(nil); _threadsetproc(nil);
free(p); free(p);
_threadpexit();
} }
void void

View file

@ -197,7 +197,7 @@ extern Channel *_dowaitchan;
extern void _procstart(Proc*, void (*fn)(Proc*)); extern void _procstart(Proc*, void (*fn)(Proc*));
extern _Thread *_threadcreate(Proc*, void(*fn)(void*), void*, uint); extern _Thread *_threadcreate(Proc*, void(*fn)(void*), void*, uint);
extern void _threadexit(void); extern void _procexit(void);
extern Proc *_threadproc(void); extern Proc *_threadproc(void);
extern void _threadsetproc(Proc*); extern void _threadsetproc(Proc*);
extern int _threadlock(Lock*, int, ulong); extern int _threadlock(Lock*, int, ulong);