Closed tiif closed 2 weeks ago
I feel I have been constantly running into already mutably borrowed: BorrowError
when it comes to unblock_thread
. It always takes me a while to realise that it has something to do with unblock_thread
again.
Usually, the list of blocked thread ids is stored in a struct. Alternating between retrieving thread id (which involves a mutable borrow to the struct) and unblock thread will usually lead to BorrowMut
error because the struct often need to be borrowed again during the unblock callback.
Generally you have to take great care of your RefCell
handles. Never keep them any longer than you have to. For every function you call while holding the handle, ensure it doesn't reentrantly access the same data again.
If we didn't use RefCell
, you'd get a borrow checking error due to changing a vector while iterating it. That would be nicer but unfortunately the reference patterns are too dynamic to make that work.
For every function you call while holding the handle, ensure it doesn't reentrantly access the same data again.
This is a pretty nice way to see it, thanks.
@rustbot author
@rustbot ready
Just some final nits. :)
You can squash after taking care of those (with --keep-base
as usual).
@rustbot author
@rustbot ready
Oh, wtf... as long as there is a "requested changes" review, it won't merge, even if the merge button is pressed by the person that requested the changes...
Remove MutexID list in
SynchronizationObjects
to avoid memory leaks.cc #3967