Skip to content

Check For Draw Completion

Bill Li edited this page Sep 6, 2024 · 3 revisions

Microchip Technology Use leIsDrawing() to Check For Draw Completion

Whether your application is running in single-loop Harmony or in multiple threaded RTOS configuration, initiating changes to the GUI while the previous changes are still being rendered can lead to undesirable to catastrophic outcome.

An example of an undesirable effect visible screen tearing.

A catastrophic one would be initiating a screen-change mid-render. During a screen change, memory allocated to widgets are freed to setup a new screen. If the rendering pipeline is still trying to access these widgets, it will often crash the application.

The best way to prevent this is to safeguard application code from initiating any change to the GUI by checking if all rendering activities have completed.

The leIsDrawing() API call is exactly for this purposes.

In the case of using an RTOS, the best practice is to treat the GUI state like it is running in another thread and leIsDrawing() is the mutex to use. The state should not be altered while leIsDrawing() is returning LE_TRUE.

leIsDrawing API Call

Clone this wiki locally