in reply to Re^6: Threads sharing global variable
in thread Threads sharing global variable
So by design, it doesn't get past one line of output? except by accident on linux?
No, it is not an accident that it works on linux as it is supposed to. I'd wait for someone who could replicate your problem (on windows machines). Can't see any ticket on rt; maybe you should report this?
In any case, I suspect the misunderstanding here is about the way locking happens. In ikegami's code, the variable $a is unlocked the whole time that the threads spin in cond_wait. Only after the cond_signal does one thread lock, run the loop, and then block again. (But then, cond is always resignaled, so one thread is always working.) Could it be a signal is lost somehow? What do you get when you replace cond_signal() by cond_broadcast()?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Threads sharing global variable
by beech (Parson) on Mar 06, 2016 at 06:56 UTC | |
by Anonymous Monk on Mar 06, 2016 at 14:16 UTC | |
by BrowserUk (Patriarch) on Mar 06, 2016 at 14:40 UTC | |
by Anonymous Monk on Mar 06, 2016 at 15:00 UTC | |
by BrowserUk (Patriarch) on Mar 06, 2016 at 15:08 UTC | |
|