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. Advertisements

  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. Advertisements

  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. Advertisements

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,218
    lomtik
    Jan 13, 2005
  2. Svenn Bjerkem
    Replies:
    0
    Views:
    325
    Svenn Bjerkem
    Oct 8, 2006
  3. LB
    Replies:
    0
    Views:
    918
  4. chris
    Replies:
    1
    Views:
    277
    Dominick Baier
    Jul 13, 2006
  5. Alex Dowad
    Replies:
    4
    Views:
    675
    Michel Demazure
    May 1, 2010
  6. sahm
    Replies:
    4
    Views:
    901
  7. JL
    Replies:
    2
    Views:
    247
    Tim Chase
    Dec 14, 2013
  8. Chris Angelico
    Replies:
    4
    Views:
    319
    Tim Chase
    Dec 19, 2013
Loading...