mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
fix wait/notify regression introduced in last commit
This commit is contained in:
parent
6ba7852a62
commit
bb85f5c94d
@ -275,6 +275,7 @@ class MySystem: public System {
|
||||
|
||||
if (owner_ == t) {
|
||||
bool interrupted;
|
||||
bool notified;
|
||||
unsigned depth;
|
||||
|
||||
{ ACQUIRE(t->mutex);
|
||||
@ -303,11 +304,9 @@ class MySystem: public System {
|
||||
int rv UNUSED = pthread_cond_wait(&(t->condition), &(t->mutex));
|
||||
expect(s, rv == 0 or rv == EINTR);
|
||||
}
|
||||
|
||||
if ((t->flags & Notified) == 0) {
|
||||
remove(t);
|
||||
}
|
||||
|
||||
notified = ((t->flags & Notified) == Notified);
|
||||
|
||||
t->flags = 0;
|
||||
t->next = 0;
|
||||
|
||||
@ -320,6 +319,11 @@ class MySystem: public System {
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&mutex);
|
||||
|
||||
if (not notified) {
|
||||
remove(t);
|
||||
}
|
||||
|
||||
owner_ = t;
|
||||
this->depth = depth;
|
||||
|
||||
|
@ -241,6 +241,7 @@ class MySystem: public System {
|
||||
|
||||
if (owner_ == t) {
|
||||
bool interrupted;
|
||||
bool notified;
|
||||
unsigned depth;
|
||||
int r UNUSED;
|
||||
|
||||
@ -273,11 +274,9 @@ class MySystem: public System {
|
||||
|
||||
r = WaitForSingleObject(t->mutex, INFINITE);
|
||||
assert(s, r == WAIT_OBJECT_0);
|
||||
|
||||
if ((t->flags & Notified) == 0) {
|
||||
remove(t);
|
||||
}
|
||||
|
||||
notified = ((t->flags & Notified) == Notified);
|
||||
|
||||
t->flags = 0;
|
||||
t->next = 0;
|
||||
|
||||
@ -292,6 +291,10 @@ class MySystem: public System {
|
||||
r = WaitForSingleObject(mutex, INFINITE);
|
||||
assert(s, r == WAIT_OBJECT_0);
|
||||
|
||||
if (not notified) {
|
||||
remove(t);
|
||||
}
|
||||
|
||||
owner_ = t;
|
||||
this->depth = depth;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user