Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET REPROCESS TO
Message
From
22/12/1998 16:15:59
 
 
To
22/12/1998 15:01:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00169741
Message ID:
00169835
Views:
34
>>>>Hiya Bob ---
>>>>
>>>>I think what you want to do is avoid SET REPROCESS and just try to directly apply a LOCK() or FLOCK() to the file you want to lock. If LOCK or FLOCK return .F., no lock! If .T., then you have the file locked.
>>>
>>>I don't see a way to avoid SET REPROCESS. Issuing a "SET REPROCESS TO" without a nAttempts gives me a syntax error. Leaving it untouched, gives the FoxPro default of 0 (which is try forever, just like AUTOMATIC) if I issue a LOCK(), or RLOCK(), or FLOCK().
>>>
>>>Bob
>>>
>>>>>According to the help file, SET REPROCESS to AUTOMATIC, is the same as SET REPROCESS to –2, is the same as SET REPROCESS to 0 … Try forever and let the user terminate with the escape key. SET REPROCESS TO –1 is also the same, except hitting escape won’t terminate it.
>>>>>
>>>>>We’ve got 4 ways to make it try forever, but I can’t find any way to make it try just once, and then give up and return .F.
>>>>>
>>>>>According to help, nAttempts (as in SET REPROCESS TO nAttempts) specifies the number of times Visual FoxPro attempts to lock a record or file AFTER AN INITIAL UNSUCCESSFUL ATTEMPT, so SET REPROCESS TO 1 should try once initially, and then 1 additional time after the unsuccessful attempt, for a total of 2 tries.
>>>>>
>>>>>Amazingly, help gives an example for nAttempts = 30 which says that “Visual FoxPro attempts to lock a record or file up to 30 times”, NOT 31 times.
>>>>>
>>>>>So, which part of help is right? Will SET REPROCESS TO 1 actually give me what I want (a single attempt, then give up), or must I use a different approach, or is there no way to get there at all?
>>>>>
>>>>>Bob
>>
>>SET REPROCESS TO 0 SECONDS gives you exactly one try. This seems to be different behavior than it was in FPW. You used to be able to SET REPROCESS TO 1 and it only did one try, no waiting. In VFP (5 anyways) it does 1 try, and THEN WAITS for whatever the REPROCESS time is.
>
>.......................
>Excellent! I've got to get more adventurous ... I let the help file stop me when it said that the value for seconds must be greater than 0.
>
>I tested your idea. 50 iterations of rlock() using set reprocess to 1 took about 17 seconds. 50 iterations of rlock() using set reprocess to 0 seconds took about 4 hundreths of a second. Thanks so much for your help.
>
>Bob

Bob,

Glad that worked out for you! The documentation is real hit or miss, but usually, what's there is correct. It's what's NOT there that's usually the problem! < G >
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform