Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: I am not able to join a thread when another child process is running which was forked using open.

by BrowserUk (Pope)
on Jan 26, 2012 at 14:49 UTC ( #950103=note: print w/ replies, xml ) Need Help??


in reply to I am not able to join a thread when another child process is running which was forked using open.

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.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?


Comment on Re: I am not able to join a thread when another child process is running which was forked using open.
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-12-28 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls