mirror of
https://github.com/corda/corda.git
synced 2025-02-02 17:21:06 +00:00
ignore DetachCurrentThread calls for the main thread
My earlier commit to allow detaching the main thread (1f1c3c4) seems to have caused subtle stability problems (e.g. https://groups.google.com/group/avian/msg/d2c797c0dcf925c3), so for now we'll just ignore that operation, which leaks a bit of memory but should be harmless otherwise.
This commit is contained in:
parent
d3b32ecffd
commit
eee2ce27e4
@ -45,6 +45,11 @@ DetachCurrentThread(Machine* m)
|
|||||||
{
|
{
|
||||||
Thread* t = static_cast<Thread*>(m->localThread->get());
|
Thread* t = static_cast<Thread*>(m->localThread->get());
|
||||||
if (t) {
|
if (t) {
|
||||||
|
// todo: detaching the root thread seems to cause stability
|
||||||
|
// problems which I haven't yet had a chance to investigate
|
||||||
|
// thoroughly. Meanwhile, we just ignore requests to detach it,
|
||||||
|
// which leaks a bit of memory but should be harmless otherwise.
|
||||||
|
if (m->rootThread != t) {
|
||||||
m->localThread->set(0);
|
m->localThread->set(0);
|
||||||
|
|
||||||
ACQUIRE_RAW(t, t->m->stateLock);
|
ACQUIRE_RAW(t, t->m->stateLock);
|
||||||
@ -56,6 +61,7 @@ DetachCurrentThread(Machine* m)
|
|||||||
enter(t, Thread::ZombieState);
|
enter(t, Thread::ZombieState);
|
||||||
|
|
||||||
t->state = Thread::JoinedState;
|
t->state = Thread::JoinedState;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user