20,741
edits
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
In FlightGear, a '''callback''' is a function that will typically be invoked by either a [[#Timers]] or a property [[#Listeners]]. One of the most common ways of using timers and listeners is FlightGear scripting via the built-in [[Nasal]] scripting language. However, the underlying code is not specific to Nasal scripting, i.e. is also widely used in native/C++ code. | In FlightGear, a '''callback''' is a function that will typically be invoked by either a [[#Timers]] or a property [[#Listeners]]. One of the most common ways of using timers and listeners is FlightGear scripting via the built-in [[Nasal]] scripting language. However, the underlying code is not specific to Nasal scripting, i.e. is also widely used in native/C++ code. | ||
Improper use of timers and listeners is one of the most common causes for FlightGear performance issues, because function callbacks (code) may be registered to be triggered/executed more often than required, this problem is not specific to [[Nasal]] code written by aircraft developers, but also C++ code written by FlightGear core developers, it's been the source of major resource leaks in FlightGear, causing severe stuttering and performance degradation over time. | {{Main article|Howto:Troubleshooting Nasal Callbacks}} | ||
{{Cautio|Improper use of timers and listeners is one of the most common causes for FlightGear performance issues, because function callbacks (code) may be registered to be triggered/executed more often than required, this problem is not specific to [[Nasal]] code written by aircraft developers, but also C++ code written by FlightGear core developers, it's been the source of major resource leaks in FlightGear, causing severe stuttering and performance degradation over time.}} | |||
The one thing that both timers and listeners have in common is that they're event handlers, i.e. mechanisms that allow custom code to be executed whenever a certain event is triggered, such as a configurable timer expiring and/or a property being updated/modified. | The one thing that both timers and listeners have in common is that they're event handlers, i.e. mechanisms that allow custom code to be executed whenever a certain event is triggered, such as a configurable timer expiring and/or a property being updated/modified. |