Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: Blocking execution of called programs to reduce buffer sizeby Peterpion (Acolyte) |
on Feb 24, 2014 at 10:47 UTC ( [id://1075965]=note: print w/replies, xml ) | Need Help?? |
Ahh I see (and mentally it all falls into place for me)! I don't know why this didn't occur to me before since I've written socket code in perl before and paid attention to blocking (and used non blocking sockets) but never really paid attention to file system blocking. I do remember reading a long time ago that pipes behaved in this way but I have sometimes come across incidents when I have used pipes in the unix shell when i've got an error which my recollection seems to suggest was related to out of memory. But I guess it all depends on both the exact way a pipe is being used and the particular commands which are being piped. Try to pipe a program / command which has to write in non blocking mode to something which does not slurp data in without hesitation will I guess cause an error if the pipe overflows. Use a command / program which uses a blocking write and all will work nicely.
So all I need to do is check my source program is opening the file in blocking mode, and if its not, simply change the opening mode to blocking and 'pausing' should automagically fall into place. I feel a bit of a twerp for having to ask this but hey ho thanks for being gentle! Cheers, Pete
In Section
Seekers of Perl Wisdom
|
|