[FL-3833] Furi: event loop (#3675)

* Furi: epoll prototype

* Gui: simplify view_dispatcher custom event processing

* Furi: add missing critical sections to epoll

* Furi: add epoll unit tests, fully implement level processing for in and out events

* Furi: properly trigger epoll item event on adding mq, update tests.

* Unit tests: cleanup defines

* Furi: protect epoll from modification in callback

* Furi: rename epoll into event_loop, cleanup api naming

* Sync API Symbols

* Furi: add event loop contract and link api, port mq to new api, cleanup code

* Format Sources

* Furi: cleanup mq and event loop code

* Furi: remove unused staff from message queue

* ApiSymbols: remove event loop from public APIs.

* Fix furi unit tests

---------

Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com>
This commit is contained in:
あく
2024-06-10 18:53:08 +01:00
committed by GitHub
parent 0bc400a3ae
commit 6d8b050eda
18 changed files with 906 additions and 79 deletions

View File

@@ -47,8 +47,8 @@ void view_dispatcher_free(ViewDispatcher* view_dispatcher);
/** Enable queue support
*
* If queue enabled all input and custom events will be dispatched throw
* internal queue
* Allocates event_loop, input and event message queues. Must be used with
* `view_dispatcher_run`
*
* @param view_dispatcher ViewDispatcher instance
*/
@@ -101,6 +101,20 @@ void view_dispatcher_set_tick_event_callback(
*/
void view_dispatcher_set_event_callback_context(ViewDispatcher* view_dispatcher, void* context);
/** Get event_loop instance
*
* event_loop instance is allocated on `view_dispatcher_enable_queue` and used
* in view_dispatcher_run.
*
* You can add your objects into event_loop instance, but don't run the loop on
* your side it will cause issues with input processing on dispatcher stop.
*
* @param view_dispatcher ViewDispatcher instance
*
* @return The event_loop instance.
*/
FuriEventLoop* view_dispatcher_get_event_loop(ViewDispatcher* view_dispatcher);
/** Run ViewDispatcher
*
* Use only after queue enabled