Commit c8c03f84 by Bryce McKinlay Committed by Bryce McKinlay

re PR libgcj/21557 (Hash synchronization: Thread.interrupt() can make _Jv_MonitorEnter hang)

2005-05-13  Bryce McKinlay  <mckinlay@redhat.com>

	PR libgcj/21557
	* java/lang/natObject.cc (_Jv_MonitorEnter): Save and clear thread
	interrupt status flag if _Jv_CondWait is interrupted.

From-SVN: r99687
parent 77d0a09d
2005-05-13 Bryce McKinlay <mckinlay@redhat.com>
PR libgcj/21557
* java/lang/natObject.cc (_Jv_MonitorEnter): Save and clear thread
interrupt status flag if _Jv_CondWait is interrupted.
2005-05-13 Tom Tromey <tromey@redhat.com> 2005-05-13 Tom Tromey <tromey@redhat.com>
* gnu/gcj/runtime/SystemClassLoader.java (init): Handle empty * gnu/gcj/runtime/SystemClassLoader.java (init): Handle empty
......
...@@ -35,6 +35,8 @@ details. */ ...@@ -35,6 +35,8 @@ details. */
using namespace java::lang;
// This is used to represent synchronization information. // This is used to represent synchronization information.
struct _Jv_SyncInfo struct _Jv_SyncInfo
{ {
...@@ -926,12 +928,22 @@ retry: ...@@ -926,12 +928,22 @@ retry:
release_set(&(he -> address), (address | REQUEST_CONVERSION | HEAVY)); release_set(&(he -> address), (address | REQUEST_CONVERSION | HEAVY));
// release lock on he // release lock on he
LOG(REQ_CONV, (address | REQUEST_CONVERSION | HEAVY), self); LOG(REQ_CONV, (address | REQUEST_CONVERSION | HEAVY), self);
// If _Jv_CondWait is interrupted, we ignore the interrupt, but
// restore the thread's interrupt status flag when done.
jboolean interrupt_flag = false;
while ((he -> address & ~FLAGS) == (address & ~FLAGS)) while ((he -> address & ~FLAGS) == (address & ~FLAGS))
{ {
// Once converted, the lock has to retain heavyweight // Once converted, the lock has to retain heavyweight
// status, since heavy_count > 0 . // status, since heavy_count > 0.
_Jv_CondWait (&(hl->si.condition), &(hl->si.mutex), 0, 0); int r = _Jv_CondWait (&(hl->si.condition), &(hl->si.mutex), 0, 0);
if (r == _JV_INTERRUPTED)
{
interrupt_flag = true;
Thread::currentThread()->interrupt_flag = false;
}
} }
if (interrupt_flag)
Thread::currentThread()->interrupt_flag = interrupt_flag;
keep_live(addr); keep_live(addr);
// Guarantee that hl doesn't get unlinked by finalizer. // Guarantee that hl doesn't get unlinked by finalizer.
// This is only an issue if the client fails to release // This is only an issue if the client fails to release
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment