Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Semaphore Locking
Message
From
05/12/2001 10:05:11
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00589685
Message ID:
00589823
Views:
23
>Hi ,
>
>I'm trying to do the following [this works fine in VFP]
>
>semaphore table contains (tablename, id, username)
>
>If user wants to edit a particular order say,
>I look for the tablename+id in the semaphore table.
> If found I try to rlock it (in case previous user crashed etc) if I can rlock it then user can edit it.
> if not found then add record + rlock() it...
>
>I was hoping I would be able to write a SP to do the above and return true if successful.
>
>This is the only way I can think of to implement a pessimistic locking strategy...
>
>Regards
>
>Kal

Kalim,
Previously I did something similar to it. In semaphomore table instead of a lock I used a flag and timestamps. When editing starts invoker turns the flag on + writes editing start time, last notification time. It's not important which station or server's time it's because notification timestamp field is updated on given intervals (say 10 secs - shifting previous value to starttime). Another station if wants to get record and sees it's there with flag on, first checks if lastnotified - starttime is greater than max allowed notification time. If greater the station started it considered dead. Otherwise informs user that 'edit in progress' and disables editing, invoking a timer that checks availability to refresh updated data. This is not pessimistic locking but simulating it (I think:).
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
Next
Reply
Map
View

Click here to load this message in the networking platform