Sys(3051), Sys(3052)

The goal of these two functions is to give you increased control over file and record locking. SYS(3051) supposedly lets you specify the length of time FoxPro waits before trying again to lock a file. SYS(3052) lets you decide what FoxPro does if an index or memo file is locked and you want to lock it.

Usage

cWaitTime = SYS( 3051 [, nWaitTime ] )

Parameter

Value

Meaning

nWaitTime

0

Reset to default (333 milliseconds).

100 to 1000

The time, in milliseconds, FoxPro should wait between attempts to lock a file or record, if SET REPROCESS calls for multiple attempts.

Omitted

Return the current setting.

cWaitTime

Character

The current setting for wait time. If you pass a legal value for nWaitTime, returns the new setting as a character string.


Various settings for SET REPROCESS tell FoxPro to keep trying to lock something, either indefinitely or a certain number of times or for a certain length of time. Trying over and over and over without pausing for breath is sort of like continuously dialing a phone number that's giving you a busy signal. All it does is tie up the phone lines. It makes more sense to wait a minute to let the person get off the phone. Similarly, it makes sense to wait between locking attempts to let the other user finish with whatever you're trying to lock. That's what this function is all about. We had a hard time seeing the effects of this function. It turns out that you really need to have two separate VFP sessions for it to make a difference. It's not good enough to test with different aliases in the same work area or even with private data sessions.

Usage

cHonorReprocess = SYS( 3052, nFileType [, lHonorReprocess ] )

Parameter

Value

Meaning

nFileType

1

Index Files

2

Memo Files

lHonorReprocess

Logical

Should attempts to lock the specified file type honor the current reprocess setting?

Omitted

Return the current setting for the specified file type.

cHonorReprocess

"0"

VFP doesn't honor the reprocess setting for the specified file type.

"1"

VFP honors the reprocess setting for the specified file type.


We've heard of just a few applications that, every once in a while, have a problem locking an index file. We suspect there may be some differences in the mechanisms used to lock individual records and those used for their counterparts in memo and index files that lead to such problems. If our speculations are true, this function was designed to remedy such problems.By default, FoxPro tries over and over and over to lock the index or memo files it needs. This function lets you set some limits on those attempts.We should add that we've been unable to come up with a situation in which this function makes a difference, but we think it might for those applications we mentioned above. We asked around but couldn't find anyone who's ever needed to actually use this function, though.Both of these functions, by the way, like just about all the SYS() functions, remind us that the FoxPro team is composed of C programmers. Return numeric and logical values as character? C'mon, get real!

Example

* Lengthen the reprocess delay
= SYS(3051,1000)

See Also

Set Reprocess


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .