Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about RLOCK(), SET REPROCESS TO...
Message
From
30/10/2001 10:25:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00575019
Message ID:
00575055
Views:
27
>After years, I find that I may not understand record locking as well as I thought!
>
>Let's say I have a SET REPROCESS TO 10 SECONDS
>
>And then I try to do an RLOCK() on a record that a user wants to edit.
>
>Let's say the RLOCK() fails after 10 seconds...control goes to my error handler.
>
>In the error handler, I trap error 108 (record is in use)...the 'problem' is that in the error handler, I want to be able to present the user with a messagebox and ask them if they want to retry (so they can go find out who has the record locked, then respond to the message). However, it appears that RETRY doesn't try for another 10 seconds to lock. Is that correct?
>
>TIA,
>Kevin

Kevin,
You get error after rlock(). How about another approach :
declare Sleep in Win32API integer
set reprocess to 1 && Try once only
start=datetime()
do while !rlock()
 if datetime()-start > 10 && 10 secs passed and not locked
   if messagebox('Continue to wait ?',YESNO)=NO
      exit
   else
      start=datetime() && reset timing
   endif
 endif
 Sleep(10) && A short delay to prevent deadlock
enddo
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform