Hacker News new | ask | show | jobs
by antonovka 6137 days ago
The general answer for event-based systems is: reentrantly spin the event loop from the test and block waiting on the result.

The general answer for actor-based systems is: wait on a blocking message receive from the actor task.

The general answer for simple shared mutable state thread-systems is: Write a complex condition-lock and thread combination (which will probably be subtly wrong the first time) to block your thread and wait on the result triggering the condition.