Skip to content
Snippets Groups Projects
Commit 6cd8f51f authored by Florian Schmaus's avatar Florian Schmaus
Browse files

Merge branch 'fix-actor' into 'master'

[UnboundedBlockingMpscQueue] Fix message loss

See merge request i4/manycore/emper!31
parents fb30089c f84726b1
No related branches found
No related tags found
No related merge requests found
...@@ -63,9 +63,14 @@ class UnboundedBlockingMpscQueue : public Blockable<LogSubsystem::U_B_MPSC_Q> { ...@@ -63,9 +63,14 @@ class UnboundedBlockingMpscQueue : public Blockable<LogSubsystem::U_B_MPSC_Q> {
if (!tPopped) { if (!tPopped) {
Context* context = Context::getCurrentContext(); Context* context = Context::getCurrentContext();
block([this, context, postRetrieve] { 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; blockedContext = context;
tryToGetElement(postRetrieve);
if (tPopped) { if (tPopped) {
tryToWakeupBlockedContext(); tryToWakeupBlockedContext();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment