Open rogercloud opened 2 years ago
I have done this in #41 (replacing std lock with spin).
In fact, since everything is running on a single thread, we know that there won't be any contention but it's possible to be deadlock. So what we really want is something like RefCell
but also Sync
. It should panic once try_lock failed.
I have done this in #41 (replacing std lock with spin). In fact, since everything is running on a single thread, we know that there won't be any contention but it's possible to be deadlock. So what we really want is something like
RefCell
but alsoSync
. It should panic once try_lock failed.
We can't guarantee the single thread scenario as a multi-thread runtime, such as tokio, may be adopted. I guess you mean single thread in sim scenario.
Oh yes. I'll do it for std part soon.
The main API difference between the two libs is poison detection. Poison detection is useful when panic happens in some thread while others are still runing, but it's not the case in this lib. In a rpc lib, we usually panic when the whole system breaks and can't be recovered, otherwise we should not panic. In another word there's no need to detection mutex poison in madsim.
Apart from poison detection parking_lot locks have better performance in most cases. So switch to parking_lot sync lock is the obvious choice from my view.