C
c_campise
Hello all-
I have a 'simple' application that creates a thread that calls an
external Windows program that runs for about 5 minutes or so. The
problem is the routine that creates this thread is never returned
control after the join() has been called when the thread terminates.
Sample Code :
use threads;
$|++; # autoflush enabled
print "Calling GenerateThread()\n";
GenerateThread();
print "Exited GenerateThread()\n";
exit(1)
sub GenerateThread()
{
my $thread1 = threads->create(\&ExecuteThread);
my $val1 = $thread1->join;
print "DONE with ExecuteThread()\n";
}
sub ExecuteThread()
{
# sit and wait for command to finish....
$szResult = `MyWindowsCommandLineProgram`;
print "MyWindowsCommandLineProgram has COMPLETED\n";
}
----- actual program output ---------
Calling GenerateThread()
MyWindowsCommandLineProgram has COMPLETED
DONE with ExecuteThread()
------end actual output -------------
What I never see is control returned to where GenerateThread() was
called. I expected to see :
----- expected program output ---------
Calling GenerateThread()
MyWindowsCommandLineProgram has COMPLETED
DONE with ExecuteThread()
Exited GenerateThread() <<--- ????
-------end expected ouput -------------
Any ideas what I'm doing wrong?
Thanks in advance!
Chris
I have a 'simple' application that creates a thread that calls an
external Windows program that runs for about 5 minutes or so. The
problem is the routine that creates this thread is never returned
control after the join() has been called when the thread terminates.
Sample Code :
use threads;
$|++; # autoflush enabled
print "Calling GenerateThread()\n";
GenerateThread();
print "Exited GenerateThread()\n";
exit(1)
sub GenerateThread()
{
my $thread1 = threads->create(\&ExecuteThread);
my $val1 = $thread1->join;
print "DONE with ExecuteThread()\n";
}
sub ExecuteThread()
{
# sit and wait for command to finish....
$szResult = `MyWindowsCommandLineProgram`;
print "MyWindowsCommandLineProgram has COMPLETED\n";
}
----- actual program output ---------
Calling GenerateThread()
MyWindowsCommandLineProgram has COMPLETED
DONE with ExecuteThread()
------end actual output -------------
What I never see is control returned to where GenerateThread() was
called. I expected to see :
----- expected program output ---------
Calling GenerateThread()
MyWindowsCommandLineProgram has COMPLETED
DONE with ExecuteThread()
Exited GenerateThread() <<--- ????
-------end expected ouput -------------
Any ideas what I'm doing wrong?
Thanks in advance!
Chris