efl loop - provide efl namespace versions of begin/end locks on mainloop
add efl_main_loop_steal() and efl_main_loop_release() for new efl namespace versiosn of ecore_thread_main_loop_begin() and ecore_thread_main_loop_end().
This commit is contained in:
parent
4717f358da
commit
76b837002e
|
@ -113,6 +113,32 @@ EAPI Eina_Promise *efl_loop_main_promise_new(Eina_Promise_Cancel_Cb cancel_cb, c
|
|||
/* We ue the factory pattern here, so you shouldn't call eo_add directly. */
|
||||
EAPI Eo *efl_main_loop_get(void);
|
||||
|
||||
/**
|
||||
* Sync with main loop and lock it out and begin a mainloop eo context
|
||||
*
|
||||
* @result The number of time ecore_thread_main_loop_begin() has been called
|
||||
* in this thread. If not, it returns @c -1.
|
||||
*
|
||||
* This function suspends the main loop in a safe state and then lets
|
||||
* use any EFL call you want after it returns as if it were running in the
|
||||
* main loop (except it's called from the calling thread). Be careful since
|
||||
* the main loop is blocked until you call efl_main_loop_release(). This is
|
||||
* the only sane way to achieve pseudo thread safety.
|
||||
*
|
||||
* Note that until the main loop is blocked, this function stalls until the
|
||||
* main loop comes to a safe point to be paused.
|
||||
*/
|
||||
EAPI int efl_main_loop_steal(void);
|
||||
|
||||
/* Release a main loop lock taken by efl_main_loop_steal()
|
||||
*
|
||||
* @result The number of times efl_main_loop_release() needs to be called
|
||||
* before the main loop is unlocked again. @c -1 will be returned if you
|
||||
* are trying to unlock when no matching call to efl_main_loop_steal() was
|
||||
* made by this thread.
|
||||
*/
|
||||
EAPI int efl_main_loop_release(void);
|
||||
|
||||
typedef struct _Efl_Future_Composite_Progress Efl_Future_All_Progress;
|
||||
|
||||
struct _Efl_Future_Composite_Progress
|
||||
|
|
|
@ -66,6 +66,18 @@ efl_main_loop_get(void)
|
|||
return efl_loop_main_get(EFL_LOOP_CLASS);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
efl_main_loop_steal(void)
|
||||
{
|
||||
return ecore_thread_main_loop_begin();
|
||||
}
|
||||
|
||||
EAPI int
|
||||
efl_main_loop_release(void)
|
||||
{
|
||||
return ecore_thread_main_loop_end();
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_loop_iterate(Eo *obj, Efl_Loop_Data *pd)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue