Skip to content

Commit a003496

Browse files
Added a comment explaining why unprioritized jobs are not handled for non-drainer locking.
1 parent 5ab2c36 commit a003496

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,11 @@ retry:;
16651665

16661666
// Claim incoming jobs when obtaining lock as a drainer, to save one
16671667
// round of atomic load and compare-exchange.
1668+
// This is not useful when obtaining lock for assuming thread during actor
1669+
// switching, because arbitrary use code can run between locking and
1670+
// draining the next job. So we still need to call processIncomingQueue() to
1671+
// check for higher priority jobs that could have been scheduled in the
1672+
// meantime. And processing is more efficient when done in larger batches.
16681673
if (asDrainer) {
16691674
newState = newState.withFirstUnprioritisedJob(nullptr);
16701675
}

0 commit comments

Comments
 (0)