+2000-09-30 Tom Tromey <tromey@cygnus.com>
+
+ * posix-threads.cc (_Jv_CondWait): Check to see if we are
+ interrupted before modifying the cv's wait set.
+
2000-09-30 Hans Boehm <boehm@acm.org>
Bryce McKinlay <bryce@albatross.co.nz>
// posix-threads.cc - interface between libjava and POSIX threads.
-/* Copyright (C) 1998, 1999 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
This file is part of libgcj.
_Jv_Thread_t *current = _Jv_ThreadCurrentData ();
java::lang::Thread *current_obj = _Jv_ThreadCurrent ();
+ pthread_mutex_lock (¤t->wait_mutex);
+
+ // Now that we hold the wait mutex, check if this thread has been
+ // interrupted already.
+ if (current_obj->interrupt_flag)
+ {
+ pthread_mutex_unlock (¤t->wait_mutex);
+ return _JV_INTERRUPTED;
+ }
+
// Add this thread to the cv's wait set.
current->next = NULL;
}
}
- pthread_mutex_lock (¤t->wait_mutex);
-
- // Now that we hold the wait mutex, check if this thread has been
- // interrupted already.
- if (current_obj->interrupt_flag)
- {
- pthread_mutex_unlock (¤t->wait_mutex);
- return _JV_INTERRUPTED;
- }
-
// Record the current lock depth, so it can be restored when we re-aquire it.
int count = mu->count;
done_sleeping = true;
}
- // Check for an interrupt *before* unlocking the wait mutex.
+ // Check for an interrupt *before* releasing the wait mutex.
jboolean interrupted = current_obj->interrupt_flag;
pthread_mutex_unlock (¤t->wait_mutex);