Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Pass a IO::Socket handle to a thread

by zentara (Archbishop)
on Dec 03, 2012 at 10:44 UTC ( #1006845=note: print w/ replies, xml ) Need Help??


in reply to Pass a IO::Socket handle to a thread

I don't know about the code you posted, but to pass a handle to a thread, use the fileno of the handle.

# some pseudo code my $fileno = fileno($fh); threads->create( \&thread, $fileno )->detach; sub thread{ my( $fileno ) = @_; open my $fh, ">&=$fileno" or warn $! and die; print $fh "thread# ",threads->tid()," -> $fileno \n" ; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh


Comment on Re: Pass a IO::Socket handle to a thread
Download Code
Re^2: Pass a IO::Socket handle to a thread
by Anonymous Monk on Dec 03, 2012 at 11:22 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2015-07-02 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (33 votes), past polls