in reply to Re^2: manage file in parallel
in thread manage file in parallel

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^4: manage file in parallel
by azaria (Beadle) on Jun 06, 2006 at 11:12 UTC
    i generated this file as you suggested. What is the diffrent between 'touch' and 'mkfifo' ? do you have example how do i use this file to manage a fifo concept ? Thanks in advance azaria

      One updates the last modification and access times of a plain file (creating it if it doesn't exist); the other makes a named pipe in the filesystem.

      Named pipes are pretty much the same as those returned by the pipe system call, except that the endpoint is accessible from the filesystem. This allows processes without a parent-child relationship to get access to the same pipe pair. I believe perlipc covers using pipe pairs, and any decent *NIX programming tome (Stevens, Rockhind) should cover them in more detail.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^4: manage file in parallel
by azaria (Beadle) on Jun 08, 2006 at 06:36 UTC
    Hi,
    I had tried the following example, but it look that the program is not completed (runs in infinite loop?!!) Any idea ? or other example that i can use for running a program that every time any other program tries to read/write from that file the reading/writing program will block until the first will complete ?
    chdir; # go home $FIFO = '.signature'; $ENV{PATH} .= ":/etc:/usr/games"; while (1) { unless (-p $FIFO) { unlink $FIFO; system('mknod', $FIFO, 'p') && die "can't mknod $FIFO: $!"; } # next line blocks until there's a reader open (FIFO, "> $FIFO") || die "can't write $FIFO: $!"; print FIFO "John Smith (smith\@host.org\n"; close FIFO; sleep 2; # to avoid dup signals }

    Formatting added by holli