summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2025-01-05 18:23:10 -0500
committerBotahamec <botahamec@outlook.com>2025-01-05 18:23:10 -0500
commit51dd003f176f649cee297f35d11fc01236cf9120 (patch)
tree2d9bf1a920e7193e92575891a907260dc68f212f
parentf58290755204ce62c528ffbf5db0bb5ca3315949 (diff)
Make ThreadKey Sync
-rw-r--r--src/key.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/key.rs b/src/key.rs
index 589f411..768f09e 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -39,6 +39,10 @@ unsafe impl Keyable for ThreadKey {}
// the ThreadKey can't be moved while a mutable reference to it exists
unsafe impl Keyable for &mut ThreadKey {}
+// Implementing this means we can allow `MutexGuard` to be Sync
+// Safety: a &ThreadKey is useless by design.
+unsafe impl Sync for ThreadKey {}
+
impl Debug for ThreadKey {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ThreadKey")