Skip to content
Snippets Groups Projects

[UnboundedBlockingMpscQueue] Fix message loss

Merged Florian Schmaus requested to merge flow/emper:fix-actor into master
1 file
+ 6
1
Compare changes
  • Side-by-side
  • Inline
@@ -63,9 +63,14 @@ class UnboundedBlockingMpscQueue : public Blockable<LogSubsystem::U_B_MPSC_Q> {
if (!tPopped) {
Context* context = Context::getCurrentContext();
block([this, context, postRetrieve] {
tryToGetElement(postRetrieve);
// N.B. It is important that we set blockedContext *after* we
// called tryToGetElement(), as otherwise, multiple threads
// may call tryToGetElement() which results in messages put in
// the queue getting lost.
blockedContext = context;
tryToGetElement(postRetrieve);
if (tPopped) {
tryToWakeupBlockedContext();
}
Loading