async-std
async-std copied to clipboard
Question: Can WakerSet be Send+Sync?
WakerSet implements its own atomic locking mechanism but is not Send or Sync. The use of it in async-std is accompanied by unsafe impl Send and Sync for containing types, but that seems like it would be more appropriate to put on the type that provides the locking mechanism for locality of reference. Is there a reason that WakerSet isn't Send + Sync but Condvar is?
I'd happily open a PR to move the unsafe impl Send and Sync to WakerSet unless I've misunderstood something about the safety of this type
Is the crate still maintained? Seems like a long time since the code was submitted?
The last commit was a month ago. Yes, async-std is still maintained
@jbr I believe you're right that there's nothing inherent to WakerSet that would prevent it from being Send. UnsafeCell is !Sync though, which we are using in WakerSet.
I'm not familiar enough with the access patterns of UnsafeCell and WakerSet to definitely answer whether we can move the Sync bound from CondVar to WakerSet. But moving the Send bound seems like it should be fine.