File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1136,6 +1136,9 @@ void DefaultActorImpl::enqueue(Job *job, JobPriority priority) {
1136
1136
}
1137
1137
}
1138
1138
1139
+ // This needs to be a store release so that we also publish the contents of
1140
+ // the new Job we are adding to the atomic job queue. Pairs with load
1141
+ // acquire in drainOne.
1139
1142
if (_status ().compare_exchange_weak (oldState, newState,
1140
1143
/* success */ std::memory_order_release,
1141
1144
/* failure */ std::memory_order_relaxed)) {
@@ -1176,6 +1179,7 @@ void DefaultActorImpl::enqueue(Job *job, JobPriority priority) {
1176
1179
Job * DefaultActorImpl::drainOne () {
1177
1180
SWIFT_TASK_DEBUG_LOG (" Draining one job from default actor %p" , this );
1178
1181
1182
+ // Pairs with the store release in DefaultActorImpl::enqueue
1179
1183
auto oldState = _status ().load (std::memory_order_acquire);
1180
1184
1181
1185
auto jobToPreprocessFrom = oldState.getFirstJob ();
@@ -1389,6 +1393,8 @@ retry:;
1389
1393
SWIFT_TASK_DEBUG_LOG (" Thread attempting to jump onto %p, as drainer = %d" , this , asDrainer);
1390
1394
#endif
1391
1395
1396
+ // Note: This doesn't have to be a load acquire because the jobQueue is part
1397
+ // of the same atomic.
1392
1398
auto oldState = _status ().load (std::memory_order_relaxed);
1393
1399
while (true ) {
1394
1400
You can’t perform that action at this time.
0 commit comments