Futures BiLock vs std Mutex


What makes a futures::sync::BiLock “not as generic as a full-blown mutex”? What prevents me from just putting a BiLock<T> in an Arc and sharing it between tasks?


Reading the code will give the answer.
A first task that uses poll_lock will not get notification if second task also makes the call.

Also don’t trust code comments to be completely correct.
This could be triggered. Two executors on two threads could get here. (a third thread with the other half needed too.) The panic like all would be a denial of service but safe from further exploitation.


Wow, thanks, ok, I think that should’ve been more clear from the documentation…