Coro + rand() + win7 == broke

Rob Schaber robschaber at gmail.com
Thu Mar 7 06:06:57 CET 2013


Hi, Marc.

First off, thanks for the modules you've authored. I've been doing event 
loop programming for the first time with them and it's been really great.

I ran into a problem with Coro and random numbers today. Seems to only 
happen on Windows (your favorite platform). To reproduce:

use Coro;
rand;
async { print rand(), "\n" }->join for 1 .. 10;

Will print the same 10 numbers every time on my Win7 x64 machine with 
perl 5.14. It works properly on virtualized Ubuntu and Windows XP (x86).

Removing the 2nd line (the call to rand from the main thread) makes the 
problem go away.

I don't have another physical w7 machine to test on, so I can't say with 
certainty that this isn't localized to my particular setup, but I did 
test on a clean VM install of the same OS and the latest Strawberry perl 
with the same results.

Eventually I just need to migrate off Windows entirely if I plan to keep 
using Perl. I was driven to your modules in the first place because of 
stupid Windows bugs (ithreads crashing the interpreter). But now I see 
coroutines are the One True Way, so.. happy accident, that.

Anyway, I thought I should bring the matter to your attention. Thanks if 
you decide to look into it.



More information about the anyevent mailing list