Re: question

[email protected] (Mike Pomraning)
Newsgroups perl.ithreads
Message-ID <[email protected]>
On Tue, 20 Jun 2006, Collins, Ellen \(RSCH\) wrote:

> I am running perl.5.8.7.
> My script is attached. It does not run asynchronously. The commands
> execute one at a time.
> Does this work on windows? I am using windows 2000.
> Any help is much appreciated since I have spent much time on this
> problem.
> THANKS!
>  <<test2.pl>> 

...

|| $thr1=threads->new(&sub1);
|| $thr2=threads->new(&sub2);

You are calling sub1 and sub2, rather than passing the CODE refs themselves
as entry points for your threads.  I believe you mean to say:

  $thr1=threads->new(\&sub1);
  $thr2=threads->new(\&sub2);

|| # clean up the threads
|| $thr1->detach; 
|| $thr2->detach; 
||
|| exit(0);

Note, unless you synchronize with your spawned threads, your program will
probably complain that "A thread exited while %d other threads were still
running" when you exit here.

Regards,
Mike
--
cat: .signature: Level 2 halted
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.