kprotty/usync

Questions about detecting panics in peer mutexes

tttwang23 opened this issue · 2 comments

Question for the author about detecting panics that occurred in a prior mutex region. Is this detection the responsibility of client caller?

I thought a MutexGuard might not span the entire mutex region to provide reliable panic detection, since it only tracks access point of the embedded data; is this correct?

You can panic while holding a MutexGuard. ATM it will just drop the guard and unlock the mutex if you have panic=unwind.

I won't be adding panic detection as it personally isn't useful + increases primitive sizes and adds extra api fluff.

You can create your own poison detection using a custom MutexGuard wrapper which checks for std::thread::panicking() when being dropped (along with unlocking). This is what std::sync::MutexGuard current does

It's been a while. Feel free to re-open if your question wasn't answered.