file read/write synchronization: advice needed

Discussion in 'Perl Misc' started by Junpei, May 29, 2004.

  1. Junpei

    Junpei Guest

    problem: I have a program A that writes (overwrite) to a file 5
    times/second (the results of a realtime calculation); i want several
    other programs B through E to occasionally read that file to see what
    the current results are (I only need the current results). how do i
    keep the programs B to E from trying to read while program A is
    writing? or is there a better solution than writing to a file? hoping
    for an easy solution... i'm on linux.
    thanks in advance,
    Junpei
    Junpei, May 29, 2004
    #1
    1. Advertising

  2. Junpei

    Ben Morrow Guest

    Quoth (Junpei):
    > problem: I have a program A that writes (overwrite) to a file 5
    > times/second (the results of a realtime calculation); i want several
    > other programs B through E to occasionally read that file to see what
    > the current results are (I only need the current results). how do i
    > keep the programs B to E from trying to read while program A is
    > writing? or is there a better solution than writing to a file? hoping
    > for an easy solution... i'm on linux.


    perldoc -f flock

    Ben

    --
    I've seen things you people wouldn't believe: attack ships on fire off
    the shoulder of Orion; I watched C-beams glitter in the dark near the
    Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
    Time to die.
    Ben Morrow, May 29, 2004
    #2
    1. Advertising

  3. Ben Morrow <> wrote:
    >
    > Quoth (Junpei):
    >> problem: I have a program A that writes (overwrite) to a file 5
    >> times/second (the results of a realtime calculation); i want several
    >> other programs B through E to occasionally read that file to see what
    >> the current results are (I only need the current results). how do i
    >> keep the programs B to E from trying to read while program A is
    >> writing? or is there a better solution than writing to a file? hoping
    >> for an easy solution... i'm on linux.

    >
    > perldoc -f flock



    See also:

    perldoc -q "\block"


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, May 29, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lomtik
    Replies:
    2
    Views:
    1,012
    lomtik
    Jan 13, 2005
  2. Svenn Bjerkem
    Replies:
    0
    Views:
    234
    Svenn Bjerkem
    Oct 8, 2006
  3. JL
    Replies:
    2
    Views:
    86
    Tim Chase
    Dec 14, 2013
  4. Cameron Simpson
    Replies:
    0
    Views:
    78
    Cameron Simpson
    Dec 15, 2013
  5. Tim Chase
    Replies:
    0
    Views:
    85
    Tim Chase
    Dec 16, 2013
Loading...

Share This Page