Created
March 21, 2019 16:34
-
-
Save alexcrichton/4c7e0862a8cfc06a2151a9ba6e47ecf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/rayon-core/src/registry.rs b/rayon-core/src/registry.rs | |
index 63d8a31..ced0b9c 100644 | |
--- a/rayon-core/src/registry.rs | |
+++ b/rayon-core/src/registry.rs | |
@@ -589,6 +589,13 @@ impl WorkerThread { | |
}); | |
} | |
+ unsafe fn unset_current() { | |
+ WORKER_THREAD_STATE.with(|t| { | |
+ assert!(!t.get().is_null()); | |
+ t.set(std::ptr::null()); | |
+ }); | |
+ } | |
+ | |
/// Returns the registry that owns this worker thread. | |
pub fn registry(&self) -> &Arc<Registry> { | |
&self.registry | |
@@ -789,6 +796,7 @@ unsafe fn main_loop( | |
} | |
// We're already exiting the thread, there's nothing else to do. | |
} | |
+ WorkerThread::unset_current(); | |
} | |
/// If already in a worker-thread, just execute `op`. Otherwise, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment