handle locking for synchronized native methods

This commit is contained in:
Joel Dice 2008-01-11 10:49:11 -07:00
parent 13fae991fd
commit 570925ad0e

View File

@ -3949,6 +3949,14 @@ invokeNative2(MyThread* t, object method)
&byteArrayBody(t, methodName(t, method), 0));
}
if (methodFlags(t, method) & ACC_SYNCHRONIZED) {
if (methodFlags(t, method) & ACC_STATIC) {
acquire(t, methodClass(t, method));
} else {
acquire(t, *reinterpret_cast<object*>(args[0]));
}
}
{ ENTER(t, Thread::IdleState);
result = t->m->system->call
@ -3960,6 +3968,14 @@ invokeNative2(MyThread* t, object method)
returnType);
}
if (methodFlags(t, method) & ACC_SYNCHRONIZED) {
if (methodFlags(t, method) & ACC_STATIC) {
release(t, methodClass(t, method));
} else {
release(t, *reinterpret_cast<object*>(args[0]));
}
}
if (DebugNatives) {
fprintf(stderr, "return from native method %s.%s\n",
&byteArrayBody(t, className(t, methodClass(t, method)), 0),