1,277
edits
Changes
m
→Implementation: sections
Condition return</pre>}}
;Implementation details
* The first lone speaker or listener will be counted as ''active'', or in the process of exchanging a message and returning, and will sleep on the {{c|return}} condition variable until its counterpart wakes it up so that they can both return.
* A second thread performing the same action as a currently active thread will be counted as ''waiting'', and be put to sleep on its respective condition variable. Otherwise, it will check if there is an ''active'' thread of its counterpart action waiting on the {{c|return}} condition variable. If there isn't, it will attempt to wake waiting threads of its counterpart action prior to going to sleep on the return condition variable. If there is a counterpart ''active'' thread, it will wake it up and they both will return. Prior to returning, the counterpart action will also attempt to wake ''waiting'' threads of its type.