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());
if (t) {
expect(t, t != m->rootThread);
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;
} else {
return -1;

View File

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