the.bay.news

Question on Send and Sync implementation of RwLock

The Rust Programming Language Forum
Question on Send and Sync implementation of RwLock
I understand why T: Send bound is present in the Send impl, it's because if we acquire a write lock then we could mem::swap and send our T of to another thread. I also understand why T: Send bound is present in the Sync impl, the same reasoning from above applies here as well, correct? But I don't understand the + Sync bound in the Sync impl, why T needs to be both Send and Sync for Rwlock to be Sync? Could someone please explain why? thanks!

I understand why T: Send bound is present in the Send impl, it's because if we acquire a write lock then we could mem::swap and send our T of to another thread. I also understand…

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.