Xref: utzoo comp.databases:2886 comp.sys.ibm.pc:31057 comp.dcom.lans:3108 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!newstop!texsun!texbell!uhnix1!uhnix2!uhvax1!coscb0g From: COSCB0G@uhvax1.uh.edu (InSik Kim) Newsgroups: comp.databases,comp.sys.ibm.pc,comp.dcom.lans Subject: Re: Concurrency Control + Question Message-ID: <775@uhvax1.uh.edu> Date: 3 Jul 89 18:15:56 GMT References: <25232@shemp.CS.UCLA.EDU> <221@ic2020.UUCP> <96@mdi386.UUCP> Organization: University of Houston Lines: 51 In article <96@mdi386.UUCP>, bruce@mdi386.UUCP (Bruce A. McIntyre) writes: > in article <25232@shemp.CS.UCLA.EDU>, gblee@maui.cs.ucla.edu says: > > Please consider the following problems: ... > The simple foxbase+ code to lock and edit a record is > find name && lookup the correct record. > if rlock() && returns true if record lock successfull. > edit && edit this record. ( or modify somehow ) > unlock() && unlock all locks you have set > else > ... display message, that you can not lock this record. > endif > MY QUESTION: > The only problem I have had is on some operations that could effect ALL > records, Exclusive access is required. I have not found a simple way > to gain exclusive access. Anyone have a simple solution ? > > --Geunbae Lee,m UCLA-CS-AI. That can be done same way as record locking, i.e. USE filename ..... && use database file if FLOCK() && returns true if flie lock successful ... ... && do the operation ... UNLOCK() && unlock the file else ... display message endif or, if you want to lock it in loop with time out, STORE nnn TO time_out && nnn is time_out period USE filename && use database file STORE 0 TO time && initialize time DO WHILE time <= time_out .OR. FLOCK() STORE time+d_time TO time && d_time is time interval ENDDO IF time > time_out && file locking failed ... display message for failure and prepare exit ENDIF ... && do the necessary operation ... UNLOCK() ========================================================================= InSik Kim University of Houston, University Park 4700 Calhoun, Houston, TX 77004 InterNet Address iskim@crcc.uh.edu iskim@cs.uh.edu =========================================================================