![]() |
|
Don't ask to ask, just ask | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
Hi Monks, I have a Perl script that need to be threaded (handles http requests) and also need to read and write in a forked subprocess. The subprocess has a very slow start time and I call it using the open2 function. My problem is that I cannot find a way to share the filehandles between my threads. I can do: use FileHandle; use threads::shared; use vars qw ($in, $out); share $in; share $out; # but if I try to put a handle in the variables "share" will complain # that the type is invalid $in =new FileHandle; # error So is it possible to open/create a filehandle in a thread and share/reuseit in a different thread ? Reopening with a new file handle is not an option because of the slow loading of the subprocess. Been stuck for days on trying to figure out a way to make it work. I'm looking forward to your replies, Regards. Stephane In reply to FileHandles and threads by sodul
|
|