You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using parking_lot's RwLock in some graph-like code where I use rayon to parallelize initialization of the graph. To enforce some ordering, I'm taking a write lock when I initialize a node inside the rayon loop. Unfortunately, this means the locking happens with non-deterministic ordering, and some of the early nodes start writing edges to the neighboring nodes before those get locked.
Unfortunately, the RwLockWriteGuard is not Send, so I cannot easily bring it along inside the rayon loop. However, I noticed that there is an unsafe fn force_unlock_write(&self) method. Would it make sense to add a safe wrapper that adds a Send wrapper type which uses the forget()/force_unlock_write() pattern internally?
The text was updated successfully, but these errors were encountered:
I'm using parking_lot's
RwLock
in some graph-like code where I use rayon to parallelize initialization of the graph. To enforce some ordering, I'm taking a write lock when I initialize a node inside the rayon loop. Unfortunately, this means the locking happens with non-deterministic ordering, and some of the early nodes start writing edges to the neighboring nodes before those get locked.Unfortunately, the
RwLockWriteGuard
is notSend
, so I cannot easily bring it along inside the rayon loop. However, I noticed that there is anunsafe fn force_unlock_write(&self)
method. Would it make sense to add a safe wrapper that adds aSend
wrapper type which uses theforget()
/force_unlock_write()
pattern internally?The text was updated successfully, but these errors were encountered: