in reply to Multithreaded script keeps files locked when reading output from multiple processes on Windows

On win32 threads share STDIN/STDOUT/STDERR, you get one of those per process, and when you do pipe-open, perl dup's each of STDIN/STDOUT/STDERR ...

so something something fork emulation keeps the filehandles alive and in use and undeletable

if you add close STDIN; close STDOUT; in sub thread, you'll get different output, like

Filehandle STDIN reopened as only for output

and Still cant remove file1 because No such file or directory instead of Permission denied
This isnt printed No such file or directory

  • Comment on Re: Multithreaded script keeps files locked when reading output from multiple processes on Windows (on win32 threads share STDIN/STDOUT/STDERR so close STDIN; close STDOUT;)
  • Download Code

Replies are listed 'Best First'.
Re^2: Multithreaded script keeps files locked when reading output from multiple processes on Windows (on win32 threads share STDIN/STDOUT/STDERR so close STDIN; close STDOUT;)
by rmahin (Scribe) on Jan 10, 2014 at 16:43 UTC

    Hi I appreciate your response! What you said definitely makes sense, however in that script regardless of where I close STDIN/STDOUT, I see the same output...Am I doing something wrong? Or could there be something else that is getting duplicated as well? Thanks again for the help!