in reply to Re^2: Compiling with pp on Strawberry Perl on Windows with threads fails
in thread Compiling with pp on Strawberry Perl on Windows with threads fails

This sample code shows the author using a "select" to "sleep", after invoking "fork". Other Internet postings also indicate the need for sleep after fork, on Windows.

Could you try adding a "sleep 1;" after the fork, to see if that helps ? (I am having trouble installing a working PAR::Packer).

        There is no time like the present for postponing what you ought to be doing.

  • Comment on Re^3: Compiling with pp on Strawberry Perl on Windows with threads fails

Replies are listed 'Best First'.
Re^4: Compiling with pp on Strawberry Perl on Windows with threads fails
by naudefj (Initiate) on Jul 10, 2016 at 20:03 UTC
    I have the same problem, fork() works perfectly fine until you compile the code with pp and run the executable. I've added a sleep() as suggested above, but it did help.

      fork does not work fine on windows, read perlfork

      when run outside of par on windows this test program doesn't run 50 threads 1 at a time

      when run after being par packed, the output is exactly the same as when run outside of par, except after the program ends/exits there is a memory violation

      so fork works just the same on win32 inside/outside of par, the memory violation message can be quieted with  use Win32API::File(); Win32API::File::SetErrorMode(2);

      I didn't scrutinize the OPs code to see if has logic errors because

      If you're going to be calling the code "threads" this might as well use real threads , its is much better on win32 than fork