Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Same method called
Message
From
29/12/2004 13:30:04
 
 
To
29/12/2004 11:44:58
Koos Veel
Gamma Research
Aruba
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
00972975
Message ID:
00973019
Views:
15
>In a VFP 8.0 application (.EXE) we have a timer that calls a method in an object. Same method in same (instance of) object can also be called by clicking on a button in a screen. If they would be called exactly at the same time, would that be a problem?

You can get into the same method twice, but you would probably not see this unless you were trying to have this occur. In the situation where the timer "fires" while the method is already running, the timer() event code is going to be deferred until you get to the next wait state, unless your method code issues a DOEVENTS statement. Presumably you would not do that on purpose, buf if you did, the call stack might look like:

- higher calling code
-- button.click
--- object.theMethod()
---- timer.timer()
----- object.theMethod()

A similar sequence could exist if the timer fired before the button click.

If this is not what you want, and you're concerned that it could occur, you could consider either disabling the timer or setting an object property to flag if the method is already executing, so you avoid the situation.

-- Randy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform