Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Win2k does not release locks in closed session
Message
 
To
21/04/2003 19:48:00
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00779997
Message ID:
00780754
Views:
11
I have an ooooollldd application (originally written in Dbase IV, then rewritten in Fox 2.6 about 6 years ago). We recently upgraded all our servers from NT to Windows 2000. Since then, I have had a problem with a config file being locked, and left locked, even when the user logs out.
This file has to be read and updated as data is entered. It is opened, locked, read, updated, and closed every time.

Here's a copy of the code I came up with to fix this problem:

-----
do whil open_file("config", "config", "", 1) = .f.
enddo && keep looping until you can open and lock the file
sele config
go top
go bott
skip -1
*** RESET ID NUMBER COUNTER AT BEGINNING OF MONTH
if config.month <> month(date())
replace config.month with month(date()),;
config.idnum with config.idset
endif
replace booknum with (booknum + 1)
store booknum to mbook
store year(date()) to myr
store val(str(myr)+alltrim(str(mbook))) to mbooknum
store mbooknum to mbookchek
skip
use
-----

There is only one record, but going top and bottom and skipping -1 seemed to help the program lock the record 'for real'. The skip at the bottom of the routine is for the same purpose.

I never could track the problem down completly, but it looked like there was a lot of buffering going on by the operating system that would allow two instances of my program to both think they had this file and record locked.

Since adding this code, I haven't had the problem.
Hope this helps.

Jack
Previous
Reply
Map
View

Click here to load this message in the networking platform