HP3000-L Archives

January 1998, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Mon, 5 Jan 1998 16:08:47 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
Jim writes:
> Anyway, here's our situation:  We have a program that is run by several
> users to write a record to a message file.  Before the program writes
> to the message file, it attempts to lock another file (which has a
> sequential number that is read and incremented).  If the file is
> "busy" (locked by another user), then the program is supposed to call
> the PAUSE intrinsic for 4 seconds and try again.  The program "hangs"

Not a PAUSE comment, but here's how we did that for one application:

   Change the "serial number file" into a message file, and
   pre-fill it with enough serial numbers to last a day or two
   (or longer).

   Change your code that does:

       flock
       fread
       increment
       fupdate (or fwritedir)
       funlock

   to

       fread

   Optionally, add a low priority background process whose only
   purpose in life is:

     while true do
        increment counter;
        fwrite to message file;


SS

ATOM RSS1 RSS2