Subject: | strange behavior of Win32::Process |
Date: | Sun, 27 Jul 2008 23:19:50 +0200 |
To: | bug-Win32-Process [...] rt.cpan.org |
From: | Radoslav Vargic <Radoslav.Vargic [...] sitronicsts.sk> |
Hello.
I have encountered a strange behavior of Win32::Process.
(I am running Windows XP and using Active Perl: v5.10.0 built for
MSWin32-x86-multi-thread)
(this perl version includes the 0.12 version of package Win32::Process)
It seems that keeping the $ProcessObj blocks somehow the standard usage
of threads and processes.
(on the opposite side, when I put $ProcessObj=0 before I start to work
with other processes/threads, everything works fine ...)
E.g. the following demo code comes not through and remains blocked in
the second "join command".
use strict;
use threads;
use Win32::Process;
my $ProcessObj;
sub sub1 {
print "In the thread begin\n";
sleep(1);
print "In the thread end\n";
}
sub ErrorReport{
print Win32::FormatMessage( Win32::GetLastError() );
}
Win32::Process::Create($ProcessObj,
"C:\\windows\\system32\\notepad.exe",
"notepad temp.txt",
0,
NORMAL_PRIORITY_CLASS,
".")|| die ErrorReport();
my $thr1 = threads->new(\&sub1);
print "Before Join 1\n";
$thr1->join;
print "After Join 1\n";
my $thr2 = threads->new(\&sub1);
print "Before Join 2\n";
$thr2->join;
print "After Join 2\n";
Maybe something must be specially handled to come through ... but what?
Thanks in advance.
Best regards
R. Vargic