Why is AtomicPtr Send + Sync

⚓ Rust    📅 2026-06-19    👤 surdeus    👁️ 2      

surdeus

I have noticed that AtomicPtr, despite being just a way to atomically set a pointer (the address not the value being pointed to), is Send + Sync, therefore providing a Send + Sync *mut T.

*mut T is explicitly !Send + !Sync, because it is possible to cause race conditions with *mut T.
This is still entirely true for AtomicPtr.

So why is AtomicPtr Send + Sync?

Edit: The moment i created the thread i see another one from 2015. AtomicPtr used to be !Send + !Sync.

2 posts - 2 participants

Read full topic

🏷️ Rust_feed