develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #38723] Backticks don't work in Win32 multithreaded perl

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
May 27, 2013 13:06
Subject:
[perl #38723] Backticks don't work in Win32 multithreaded perl
Message ID:
rt-3.6.HEAD-2650-1369659979-1039.38723-15-0@perl.org
On Mon Mar 13 19:17:18 2006, krzysztofk wrote:
> This is a bug report for perl from
> krzysztofk@rocketmail.com,
> generated with the help of perlbug 1.34 running under
> perl v5.8.0.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> In short when I use fork under Win32 backticks don't
> work properly.
> Following program instead of printing long list of
> lines like
> "Process x iteration y" stops writing after just a few
> iteration
> and does not exit.
> I looked through the code and found the problem.
> Function win32_popen is not thread safe.
> Recompiling perl with -DUSE_RTL_POPEN fixes the
> problem.
> 
> sub run_p($)
> {
> 	my($num) = @_;
> 	print "Process $num($$) started.\n";
> 	for(1..20){
> 		`dir`;
> 		print "Process $num iteration $_\n";
> 	}
> 	print LOG "Process $num done.\n";
> }
> 
> $|=1;
> my $NFORK=6;
> open LOG,">log.txt";
> for(1..$NFORK){
> 	my $pid;
> 	if(($pid=fork())){
> 		print "Starting process $_($pid)\n";
> 		$num{$pid} = $_;
> 	}
> 	else{
> 		sleep 1;
> 		run_p($_);
> 		exit;
> 	}
> }
> for(1..$NFORK){
> 	my $pid= wait();
> 	print STDERR "Wait returned $pid ($num{$pid})\n";
> }
> 

Reviewing older tickets this morning, I came across this one.

Krzysztofk:  It appears that by re-compiling Perl, you found a
satisfactory work-around.  Do you need further assistance with this problem?

List: Could someone familiar with the current status of 'fork' on Win32
systems please assess the issues in this ticket?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=38723

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About