Hm. Your code, with a couple of minor tweaks works fine for me:
#! perl -slw use strict; use threads; use IO::Handle; sub dummy { print "\n!!!!". $$; return 0; } open( my $handle, "| cat -v") || die "Unable to open connection to BT +Driver: $!\n"; $handle->autoflush(1); #close $handle; If I uncomment this, threads can be joined. But I don' +t want to terminate this child process. my $thr2 = threads->create(\&dummy); sleep 2; print "\n$thr2"; for my $thr (threads->list(threads::joinable)) { print "\nIam here"; print "\n!!!". $thr; print $thr->join(); } __END__ C:\test>junk72 !!!!288 threads=SCALAR(0x37b820) Iam here !!!threads=SCALAR(0x367440) 0
Try it. Then try and work out why.
In reply to Re: I am not able to join a thread when another child process is running which was forked using open.
by BrowserUk
in thread I am not able to join a thread when another child process is running which was forked using open.
by ashishyadavlko1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |