Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Threads and file descriptors

by JavaFan (Canon)
on Dec 20, 2010 at 16:43 UTC ( [id://878052]=note: print w/replies, xml ) Need Help??


in reply to Threads and file descrptors

I think the open is waiting on a socket connection to be established with the pipe
What makes you think that? Perl's open is smart, but I do not think it's so smart it actually knows the command it's executing is going to open a socket, and is going to wait for that.
So the question is do I really needs threads to solve this problem and if so how, OR is there just some faster way to get the pipes to open?
No, you don't need threads. The classical solution is a select loop (which you can do easily in Perl, and there are also some CPAN modules for it; POE for instance). Alternatively, you can fork.

If it's just a matter of opening a bunch of pipes, and reading a single line from each of them, I'd opt for select loop. Care should be taken, don't use readline, but a read.

Replies are listed 'Best First'.
Re^2: Threads and file descriptors
by markseger (Beadle) on Dec 20, 2010 at 18:45 UTC
    bingo... there was some code I discovered was executing between open calls and it WAS trying to read the next record on the pipe and so naturally had to stall while waiting for it to appear. It's so obvious after you've heard the explanation. Thanks... -mark

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-18 10:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found