File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -252,9 +252,15 @@ impl State {
252252 /// Transitions the state to `NOTIFIED`.
253253 pub ( super ) fn transition_to_notified_by_ref ( & self ) -> TransitionToNotifiedByRef {
254254 self . fetch_update_action ( |mut snapshot| {
255- if snapshot. is_complete ( ) || snapshot . is_notified ( ) {
256- // There is nothing to do in this case.
255+ if snapshot. is_complete ( ) {
256+ // The complete state is final
257257 ( TransitionToNotifiedByRef :: DoNothing , None )
258+ } else if snapshot. is_notified ( ) {
259+ // Even hough we have nothing to do in this branch,
260+ // wake_by_ref() should synchronize-with the task starting execution,
261+ // therefore we must use an Release store (with the same value),
262+ // to pair with the Acquire in transition_to_running.
263+ ( TransitionToNotifiedByRef :: DoNothing , Some ( snapshot) )
258264 } else if snapshot. is_running ( ) {
259265 // If the task is running, we mark it as notified, but we should
260266 // not submit as the thread currently running the future is
You can’t perform that action at this time.
0 commit comments