Jeff Weisberg on Fri, 11 Apr 2003 14:40:32 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Linux FIFOs



[ big thread, several posts, lots of speculation,
  a few wrong answers (write an EOF? in unix?) etc.
  -- deleted ]


there is no way for the signature writing program to
indicate to the signature reading program "stop reading"
over a fifo. but there are 2 work-arounds to solve your
problem:

1) sleep.

	while(1){
	    open  FIFO, ...;
	    print FIFO ...;
	    close FIFO;
	    sleep 1;

    and cross your fingers and hope you slept long enough.
    otherwise the reader will get 2, or 3, (...) copies.

    this trick will not fool programs such as "tail -f"

2) remove the fifo. create a new one.

	use POSIX 'mkfifo';
	while(1){
	    mkfifo ...
	    open
	    print
	    close
	    unlink ...

    and cross your fingers and hope the reader doesn't try opening
    the fifo during the time btwn when it is deleted and resurrected.

    this will always work as expected. even with smart programs.



	--jeff



_________________________________________________________________________
Philadelphia Linux Users Group        --       http://www.phillylinux.org
Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
General Discussion  --   http://lists.netisland.net/mailman/listinfo/plug