mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
handle case of not-yet-started thread in setDaemon
This commit is contained in:
parent
d00f4c5390
commit
1722b68277
@ -1444,12 +1444,6 @@ class Classpath {
|
||||
dispose() = 0;
|
||||
};
|
||||
|
||||
inline void
|
||||
runJavaThread(Thread* t)
|
||||
{
|
||||
t->m->classpath->runThread(t);
|
||||
}
|
||||
|
||||
Classpath*
|
||||
makeClasspath(System* system, Allocator* allocator, const char* javaHome,
|
||||
const char* embedPrefix);
|
||||
@ -1759,6 +1753,16 @@ instanceOf(Thread* t, object class_, object o);
|
||||
|
||||
#include "type-declarations.cpp"
|
||||
|
||||
inline void
|
||||
runJavaThread(Thread* t)
|
||||
{
|
||||
if (threadDaemon(t, t->javaThread)) {
|
||||
atomicOr(&(t->flags), Thread::DaemonFlag);
|
||||
}
|
||||
|
||||
t->m->classpath->runThread(t);
|
||||
}
|
||||
|
||||
inline object&
|
||||
root(Thread* t, Machine::Root root)
|
||||
{
|
||||
@ -2812,11 +2816,13 @@ setDaemon(Thread* t, object thread, bool daemon)
|
||||
threadDaemon(t, thread) = daemon;
|
||||
|
||||
Thread* p = reinterpret_cast<Thread*>(threadPeer(t, thread));
|
||||
if (p) {
|
||||
if (daemon) {
|
||||
atomicOr(&(p->flags), Thread::DaemonFlag);
|
||||
} else {
|
||||
atomicAnd(&(p->flags), ~Thread::DaemonFlag);
|
||||
}
|
||||
}
|
||||
|
||||
if (daemon) {
|
||||
++ t->m->daemonCount;
|
||||
|
Loading…
Reference in New Issue
Block a user