Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

synchronized method

Status
Not open for further replies.

billyng

Programmer
Dec 7, 2004
25
US
Hi folks,

In VFP, is there any way to synchronize a method (like C and Java) in order to make the threads to access a function one at a time.

Thanks in advance!

Billy
 
In VFP, you have no threads. If one function (say, THISFORM.Button1.Click) is executing, then another function (say, THISFORM.Timer.Timer, or THISFORM.Button2.Click) starts to execute, the first function is paused until the second function concludes.

You can address the synchronization by placing a check at the beginning of the second function:
IF THISFORM.lSynchronizeLocked=.T.
RETURN .F.
ENDIF
to prevent another function from interrupting.

The only place VFP can truly multithread if running as a COM server built as an MTDLL. In that case, each COM object gets its own thread, and so THISFORM (or THIS) never points to the same object when referred to by two different threads, so something like THIS.lSynchronizeLocked can't work.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top