in reply to Re^9: Threads sharing global variable (disingenous)
in thread Threads sharing global variable
I once enjoyed browsing through the articles on PerlMonks. What isn't fun is the rudeness towards other monks. Why the rudeness? But maybe, ikegami was rude in his response to your demonstration.
The interesting thing is that BrowserUk's demonstration runs with the lock obtained outside the while loop. This is also true on the Windows platform.
sub set_positive { lock $a; while (1) { ... } } sub set_zero { lock $a; while (1) { ... } }
A long time monk ikegami made a correct statement when stating the lock is re-obtained before cond_wait returns. In fact, that is mentioned in the threads::shared documentation.
Another finding is the printer output containing "0 0" indicating set_zero enqueued twice in a row. Also, the output contains two positives indicating set_positive enqueued twice in a row. These occur often in the output. The OP does not mention if such occurrence is valid, so am not sure.
Is there a code of conduct for PerlMonks? The reason is that there is no joy in seeing monks attacking one another. Recently, the Mojolicious team added a section titled Code Of Conduct to a guide. Is there anything like that for PerlMonks?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^11: Threads sharing global variable (disingenous)
by Anonymous Monk on Mar 10, 2016 at 06:25 UTC | |
by Anonymous Monk on Mar 10, 2016 at 13:58 UTC | |
|
Re^11: Threads sharing global variable (disingenous)
by BrowserUk (Patriarch) on Mar 10, 2016 at 09:26 UTC | |
|
Re^11: Threads sharing global variable (disingenous)
by Anonymous Monk on Mar 10, 2016 at 05:19 UTC | |
by BrowserUk (Patriarch) on Mar 10, 2016 at 09:12 UTC | |
by Anonymous Monk on Mar 10, 2016 at 13:48 UTC | |
by BrowserUk (Patriarch) on Mar 10, 2016 at 13:58 UTC | |
by Anonymous Monk on Mar 10, 2016 at 14:07 UTC | |
|