mirror of
https://github.com/corda/corda.git
synced 2025-01-23 21:08:48 +00:00
avoid deadlock due to entering active state before running destroyJavaVM
We risked deadlock when waiting for other non-daemon threads to exit since they could not exit without entering exclusive state, which required waiting for all other threads to go idle.
This commit is contained in:
parent
132f188ff0
commit
9ef9d9619d
@ -91,7 +91,7 @@ DestroyJavaVM(Machine* m)
|
|||||||
{
|
{
|
||||||
Thread* t; AttachCurrentThread(m, &t, 0);
|
Thread* t; AttachCurrentThread(m, &t, 0);
|
||||||
|
|
||||||
if (run(t, destroyJavaVM, 0)) {
|
if (runRaw(t, destroyJavaVM, 0)) {
|
||||||
t->exit();
|
t->exit();
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1912,12 +1912,19 @@ instanceOf(Thread* t, object class_, object o);
|
|||||||
|
|
||||||
#include "type-declarations.cpp"
|
#include "type-declarations.cpp"
|
||||||
|
|
||||||
|
inline uint64_t
|
||||||
|
runRaw(Thread* t,
|
||||||
|
uint64_t (*function)(Thread*, uintptr_t*), uintptr_t* arguments)
|
||||||
|
{
|
||||||
|
Thread::RunCheckpoint checkpoint(t);
|
||||||
|
return vmRun(function, arguments, &checkpoint);
|
||||||
|
}
|
||||||
|
|
||||||
inline uint64_t
|
inline uint64_t
|
||||||
run(Thread* t, uint64_t (*function)(Thread*, uintptr_t*), uintptr_t* arguments)
|
run(Thread* t, uint64_t (*function)(Thread*, uintptr_t*), uintptr_t* arguments)
|
||||||
{
|
{
|
||||||
ENTER(t, Thread::ActiveState);
|
ENTER(t, Thread::ActiveState);
|
||||||
Thread::RunCheckpoint checkpoint(t);
|
return runRaw(t, function, arguments);
|
||||||
return vmRun(function, arguments, &checkpoint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
|
Loading…
Reference in New Issue
Block a user