record locking question - pretty urgent

Richard Kreiss rkreiss at gccconsulting.net
Mon Oct 7 09:01:20 PDT 2013



> -----Original Message-----
> From: filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com
> [mailto:filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com] On
> Behalf Of Fairlight
> Sent: Monday, October 07, 2013 11:09 AM
> To: filePro Mailing List
> Subject: record locking question - pretty urgent
> 
> I need to design a mechanism for something, and I need to know the answer
> to something about record locking as a result.
> 
> Let's say you had 20 clerk processes all running concurrently.  Let's also say
> they need exclusive access to a single record in a table.
> 
> 1) You use a protected lookup, right?
> 
> 2) If process #3 has the protected lookup, do the other processes gain the
> ability to grab that record instantly, if they're all waiting on the record lock?
> 
> 3) As the next process grabs the locked record, is it -assured- that only
> -one- of those processes will grab the lock, forcing the rest to wait for the
> same condition, where the current process releases the locked record?
> Basically, is prevention of a race condition guaranteed?
> 
> Thanks,
> 
> mark->

Mark,

I think that the following might answer part of your question. (from 5.7 help file)

getzip if:
      then: lookup zip=zipcode k=ky i=a -npxw
        if: LOCKED(zip)
      then: goto ziplkd
   ......
 ziplkd if:
      then: p = "Press \r Y \r or \r N \r"
      then: msgbox "Zipcode \"" { ky { "\" is locked.\nTry again?",p,"YN"
        if: @BK eq "Y"  ' Pause for 5 seconds and try again.
      then: sleep "5000" ; goto getzip

No other process is going to have access to that record until the locking process releases it.  On the other hand, I am not sure of the sequence of which process will gain access next.  I think that is a "Ken" question.

That might depend on how long your programming loops to check for the lock.

Richard


More information about the Filepro-list mailing list