Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Same method called
Message
De
29/12/2004 13:30:04
 
 
À
29/12/2004 11:44:58
Koos Veel
Gamma Research
Aruba
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
00972975
Message ID:
00973019
Vues:
14
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform