[Nottingham] named pipes (fifo) help please

Rob Andrews rob at impure.org.uk
Wed Oct 26 17:58:16 BST 2005


On 26-Oct-2005 16:09.20 (BST), Martin wrote:
 > What's the best/easiest way to avoid the first (writing) process 
 > blocking on the pipe if the second process doesn't read for a long time?
 [snip]
 > (All in bash)

If this wasn't in shellscript, I'd suggest using the 'alarm' syscall to
raise an alarm and setup an alarm signal handler to return to normal
processing. alarm() is commonly used by many things to return to normal
processing from a blocking call. e.g.

signal(SIG_ALARM, <alarm_handling_function_call>);
alarm(5); /* set alarm signal to trigger in 5 seconds */
<blocking operation>;
alarm(0); /* clear alarm as operation completed */

Quite what this would do to the write operation and what would be in the
buffer that the reader would be reading from I'm not sure without
trying it.



More information about the Nottingham mailing list