-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-concurrencyArea: ConcurrencyArea: ConcurrencyA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsO-windowsOperating system: WindowsOperating system: Windows
Description
I believe rust_sched_driver has a race that may cause spurious (but harmless) wakeups on Windows:
Order of events:
- Assume
signal()is called whenstart_main_loop()is not blocked inlock.wait(). signal()will setsignalled = trueand signal the lock (which calls Windows'SetEvent()API).- When
start_main_loop()later acquires the lock,signalledis true, sostart_main_loop()skips thewait()and resetssignalledto false. - At this point,
signalledis false but the lock's event object is still in the signalled state! - When
start_main_loop()next acquires the lock,signalledis false, so the function callswait()which will return immediately because the event is still in the signalled state.
To avoid this problem, start_main_loop() would need to call ResetEvent() in step 3.
Metadata
Metadata
Assignees
Labels
A-concurrencyArea: ConcurrencyArea: ConcurrencyA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsO-windowsOperating system: WindowsOperating system: Windows