Skip to content

Commit

Permalink
Fixup #415.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-ludwig committed Oct 3, 2024
1 parent f74b0a5 commit 3728309
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions source/vibe/core/sync.d
Original file line number Diff line number Diff line change
Expand Up @@ -1379,18 +1379,17 @@ struct ManualEvent {
auto thisthr = Thread.getThis();

ThreadWaiter lw;
if (auto drv = tryGetEventDriver) {
m_waiters.lock.active.iterate((ThreadWaiter w) {
debug (VibeMutexLog) () @trusted { logTrace("waiter %s", cast(void*)w); } ();
if (w.driver is drv) {
lw = w;
lw.addRef();
} else {
w.triggerEvent();
}
return true;
});
}
auto drv = tryGetEventDriver;
m_waiters.lock.active.iterate((ThreadWaiter w) {
debug (VibeMutexLog) () @trusted { logTrace("waiter %s", cast(void*)w); } ();
if (w.driver is drv) {
lw = w;
lw.addRef();
} else {
w.triggerEvent();
}
return true;
});
debug (VibeMutexLog) () @trusted { logTrace("lw %s", cast(void*)lw); } ();
if (lw) {
lw.emit();
Expand All @@ -1413,19 +1412,18 @@ struct ManualEvent {
auto thisthr = Thread.getThis();

ThreadWaiter lw;
if (auto drv = tryGetEventDriver) {
m_waiters.lock.active.iterate((ThreadWaiter w) {
() @trusted { logTrace("waiter %s", cast(void*)w); } ();
if (w.driver is drv) {
if (w.unused) return true;
lw = w;
lw.addRef();
} else {
w.triggerEvent();
}
return false;
});
}
auto drv = tryGetEventDriver;
m_waiters.lock.active.iterate((ThreadWaiter w) {
() @trusted { logTrace("waiter %s", cast(void*)w); } ();
if (w.driver is drv) {
if (w.unused) return true;
lw = w;
lw.addRef();
} else {
w.triggerEvent();
}
return false;
});
() @trusted { logTrace("lw %s", cast(void*)lw); } ();
if (lw) {
lw.emitSingle();
Expand Down

0 comments on commit 3728309

Please sign in to comment.