इसके माध्यम से साझा किया गया


EventLoop_Stop Function

Header: #include <applibs/eventloop.h>

Stops the EventLoop from running and causes EventLoop_Run to return control to its caller.

int EventLoop_Stop(EventLoop *el);

Parameters

  • el A pointer to the EventLoop object.

Return value

Returns 0 for success, or -1 for failure, in which case errno is set to the error value.

Remarks

This function can be called from an event callback or another thread to stop the current loop and return from EventLoop_Run.

If called from a callback, EventLoop_Run will stop synchronously. Once EventLoop_Stop returns, no further events will be processed by EventLoop_Run. EventLoop_Run will then stop processing events and return to its caller.

If called from another thread, EventLoop_Run will stop asynchronously and return to its caller. As a result, EventLoop_Run may still process a few events after EventLoop_Stop returns.

An EventLoop object is a single-threaded object. An attempt to use EventLoop from multiple threads simultaneously will result in undefined behavior. The only exception is a call to `EventLoop_Stop.