Making actor non reentrant

Cross posting a solution we found: Actor Reentrancy - #16 by CrownedPhoenix

Implemented an async semaphore that uses a waiter queue and task suspension.
Then we use the async semaphore in actor methods.
Because it leverages suspensions, it won’t block the actor from doing other work but it will prevent it from doing any work that involves another method before finishing the work on the method it’s in the middle of.

Though it bears recognizing that this will still result in a deadlock if misused.
So… in that sense it kind of begs the point of the actor in the first place.

1 Like