leave thread in JoinedState instead of ZombieState in DetachCurrentThread

This commit is contained in:
Joel Dice 2009-08-18 15:29:25 -06:00
parent 01dcb1661b
commit 0eba1eeaf2
2 changed files with 11 additions and 2 deletions

View File

@ -77,8 +77,17 @@ DetachCurrentThread(Machine* m)
{ {
Thread* t = static_cast<Thread*>(m->localThread->get()); Thread* t = static_cast<Thread*>(m->localThread->get());
if (t) { if (t) {
expect(t, t != m->rootThread);
m->localThread->set(0); m->localThread->set(0);
t->exit();
ACQUIRE_RAW(t, t->m->stateLock);
enter(t, Thread::ActiveState);
enter(t, Thread::ZombieState);
t->state = Thread::JoinedState;
return 0; return 0;
} else { } else {
return -1; return -1;

View File

@ -129,7 +129,7 @@ class MySystem: public System {
virtual void join() { virtual void join() {
int rv UNUSED = pthread_join(thread, 0); int rv UNUSED = pthread_join(thread, 0);
//expect(s, rv == 0); expect(s, rv == 0);
} }
virtual void dispose() { virtual void dispose() {