summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-14 00:42:46 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-14 00:42:46 +0000
commit9e90421dd0753710669f9c7d11a9b2e51ce4111c (patch)
treebe69ae4c147f570a75735439b574986f1129c19b /libjava
parentac56a49ad4b56aa22972f3e2ba4355b1289fda32 (diff)
downloadgcc-9e90421dd0753710669f9c7d11a9b2e51ce4111c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99687 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/lang/natObject.cc16
2 files changed, 20 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 93060faf3c8..ac60b212b06 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,9 @@
+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>
* gnu/gcj/runtime/SystemClassLoader.java (init): Handle empty
diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc
index d7b67d7fa2d..aa79500fa58 100644
--- a/libjava/java/lang/natObject.cc
+++ b/libjava/java/lang/natObject.cc
@@ -35,6 +35,8 @@ details. */
+using namespace java::lang;
+
// This is used to represent synchronization information.
struct _Jv_SyncInfo
{
@@ -926,12 +928,22 @@ retry:
release_set(&(he -> address), (address | REQUEST_CONVERSION | HEAVY));
// release lock on he
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))
{
// Once converted, the lock has to retain heavyweight
- // status, since heavy_count > 0 .
- _Jv_CondWait (&(hl->si.condition), &(hl->si.mutex), 0, 0);
+ // status, since heavy_count > 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);
// Guarantee that hl doesn't get unlinked by finalizer.
// This is only an issue if the client fails to release