XPLMScheduleFlightLoop

From X-Plane SDK
Jump to: navigation, search

XPLMScheduleFlightLoop

XPLM_API void                 XPLMScheduleFlightLoop(
                                   XPLMFlightLoopID     inFlightLoopID,    
                                   float                inInterval,    
                                   int                  inRelativeToNow);    

This routine schedules a flight loop callback for future execution. If inInterval is negative, it is run in a certain number of frames based on the absolute value of the input. If the interval is positive, it is a duration in seconds.

If inRelativeToNow is true, ties are interpretted relative to the time this routine is called; otherwise they are relative to the last call time or the time the flight loop was registered (if never called).

THREAD SAFETY: it is legal to call this routine from any thread under the following conditions:

1. The call must be between the beginning of an XPLMEnable and the end of an XPLMDisable sequence. (That is, you must not call this routine from thread activity when your plugin was supposed to be disabled. Since plugins are only enabled while loaded, this also implies you cannot run this routine outside an XPLMStart/XPLMStop sequence.)

2. You may not call this routine re-entrantly for a single flight loop ID. (That is, you can't enable from multiple threads at the same time.)

3. You must call this routine between the time after XPLMCreateFlightLoop returns a value and the time you call XPLMDestroyFlightLoop. (That is, you must ensure that your threaded activity is within the life of the object. The SDK does not check this for you, nor does it synchronize destruction of the object.)

4. The object must be unscheduled if this routine is to be called from a thread other than the main thread.