How to multi-thread this?
- by WilliamKF
I wish to have two threads. The first thread1 occasionally calls the following pseudo function:
void waitForThread2() {
if (thread2 is not idle) {
return;
}
notifyThread2IamReady();
while (thread2IsExclusive) {
}
}
The second thread2 is forever in the following pseudo loop:
for (;;) {
Notify thread1 I am idle.
while…