le_eventLoop.h
Go to the documentation of this file.
13 * directly through the Event Loop API or indirectly through other APIs that use the Event Loop API)16 * Every event loop has an <b>event queue</b>, which is a queue of events waiting to be handled by41 * later (when that function gets to the head of the Event Queue) by calling l@c e_event_QueueFunction().79 * - The function to be executed takes a long time, but doesn't have to be done at a high priority.250 * the handler using @c le_event_SetContextPtr(). When the handler function is called, it can call282 * If a handler is removed after the report for that event has been added to the event queue, but285 * @note To prevent race conditions, it's not permitted for one thread to remove another thread's373 * @section c_event_reportingRefCountedObjects Event Reports Containing Reference-Counted Objects389 * @c le_event_ReportWithRefCounting() passes ownership of one reference to the Event Loop API, and391 * the handler's responsibility to release its reference (using le_mem_Release()) when it's done.394 * @c le_event_CreateIdWithRefCounting() is used the same way as le_event_CreateId(), except that455 * that thread will @b not automatically run an Event Loop. To make it run an Event Loop, it must464 * Many legacy programs written on top of POSIX APIs will have previously built their own event loop465 * using poll(), select(), or some other blocking functions. It may be difficult to refactor this type of478 * on the Event Loop, @c le_event_ServiceLoop() will only perform one servicing step (i.e., call one485 * A logging keyword can be enabled to view a given thread's event handling activity. The keyword name490 * @todo Add a reference to the Process Inspector and its capabilities for inspecting Event Queues,498 //--------------------------------------------------------------------------------------------------512 //--------------------------------------------------------------------------------------------------519 //--------------------------------------------------------------------------------------------------523 //--------------------------------------------------------------------------------------------------527 * Use this macro instead of a normal function prototype to create an Initialization Event Handler539 //--------------------------------------------------------------------------------------------------547 // This macro is set by the build system. However, if it hasn't been set, use a sensible default.575 //--------------------------------------------------------------------------------------------------583 //--------------------------------------------------------------------------------------------------585 (590 //--------------------------------------------------------------------------------------------------601 //--------------------------------------------------------------------------------------------------603 (609 //--------------------------------------------------------------------------------------------------617 //--------------------------------------------------------------------------------------------------619 (625 //--------------------------------------------------------------------------------------------------632 //--------------------------------------------------------------------------------------------------637 //--------------------------------------------------------------------------------------------------648 //--------------------------------------------------------------------------------------------------656 //--------------------------------------------------------------------------------------------------660 //--------------------------------------------------------------------------------------------------663 //--------------------------------------------------------------------------------------------------674 //--------------------------------------------------------------------------------------------------688 //--------------------------------------------------------------------------------------------------699 //--------------------------------------------------------------------------------------------------706 //--------------------------------------------------------------------------------------------------710 //--------------------------------------------------------------------------------------------------713 //--------------------------------------------------------------------------------------------------724 //--------------------------------------------------------------------------------------------------737 //--------------------------------------------------------------------------------------------------754 //--------------------------------------------------------------------------------------------------763 //--------------------------------------------------------------------------------------------------767 //--------------------------------------------------------------------------------------------------768 le_event_HandlerRef_t _le_event_AddHandler(le_event_Id_t eventId, le_event_HandlerFunc_t handlerFunc);770 //--------------------------------------------------------------------------------------------------787 //--------------------------------------------------------------------------------------------------802 //--------------------------------------------------------------------------------------------------822 //--------------------------------------------------------------------------------------------------832 //--------------------------------------------------------------------------------------------------836 //--------------------------------------------------------------------------------------------------841 //--------------------------------------------------------------------------------------------------861 //--------------------------------------------------------------------------------------------------876 //--------------------------------------------------------------------------------------------------882 //--------------------------------------------------------------------------------------------------889 //--------------------------------------------------------------------------------------------------898 //--------------------------------------------------------------------------------------------------907 //--------------------------------------------------------------------------------------------------915 * to the object, so the handler is responsible for releasing the object when it is finished with918 //--------------------------------------------------------------------------------------------------927 //--------------------------------------------------------------------------------------------------934 //--------------------------------------------------------------------------------------------------941 //--------------------------------------------------------------------------------------------------948 //--------------------------------------------------------------------------------------------------954 //--------------------------------------------------------------------------------------------------964 //--------------------------------------------------------------------------------------------------971 //--------------------------------------------------------------------------------------------------976 //--------------------------------------------------------------------------------------------------985 //--------------------------------------------------------------------------------------------------990 //--------------------------------------------------------------------------------------------------1000 //--------------------------------------------------------------------------------------------------1012 //--------------------------------------------------------------------------------------------------1020 //--------------------------------------------------------------------------------------------------1031 //--------------------------------------------------------------------------------------------------1038 //--------------------------------------------------------------------------------------------------1053 //--------------------------------------------------------------------------------------------------void * le_event_GetContextPtrFromRef(le_event_HandlerRef_t handlerRef)le_event_Id_t le_event_CreateIdWithRefCounting(const char *name)void(* le_event_LayeredHandlerFunc_t)(void *reportPtr, void *secondLayerFunc)Definition: le_eventLoop.h:603LE_FULL_API int le_event_GetFd(void)void le_event_QueueFunctionToThread(le_thread_Ref_t thread, le_event_DeferredFunc_t func, void *param1Ptr, void *param2Ptr)void le_event_Report(le_event_Id_t eventId, void *payloadPtr, size_t payloadSize)void le_event_RunLoop(void)void * le_event_GetContextPtr(void)void(* le_event_DeferredFunc_t)(void *param1Ptr, void *param2Ptr)Definition: le_eventLoop.h:619le_event_Id_t le_event_CreateId(const char *name, size_t payloadSize)void le_event_SetContextPtr(le_event_HandlerRef_t handlerRef, void *contextPtr)void le_event_ReportWithRefCounting(le_event_Id_t eventId, void *objectPtr)le_event_HandlerRef_t le_event_AddHandler(const char *name, le_event_Id_t eventId, le_event_HandlerFunc_t handlerFunc)void le_event_RemoveHandler(le_event_HandlerRef_t handlerRef)le_event_HandlerRef_t le_event_AddLayeredHandler(const char *name, le_event_Id_t eventId, le_event_LayeredHandlerFunc_t firstLayerFunc, void *secondLayerFunc)LE_FULL_API le_result_t le_event_ServiceLoop(void)void le_event_QueueFunction(le_event_DeferredFunc_t func, void *param1Ptr, void *param2Ptr)