forked from enlightenment/efl
thread fence code - move elsewhere in file to avoid conflicts
This commit is contained in:
parent
26d728be01
commit
b2ca7a96dc
|
@ -18,6 +18,47 @@ static int init_count = 0;
|
||||||
#define SHUTDOWN_TIMEOUT_CHECK (1)
|
#define SHUTDOWN_TIMEOUT_CHECK (1)
|
||||||
#define SHUTDOWN_TIMEOUT (3000)
|
#define SHUTDOWN_TIMEOUT (3000)
|
||||||
|
|
||||||
|
struct fence_stuff {
|
||||||
|
Eina_Lock lock;
|
||||||
|
Eina_Condition cond;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_thread_queue_fence(void *data)
|
||||||
|
{
|
||||||
|
struct fence_stuff *f;
|
||||||
|
|
||||||
|
f = data;
|
||||||
|
|
||||||
|
eina_lock_take(&f->lock);
|
||||||
|
eina_condition_signal(&f->cond);
|
||||||
|
eina_lock_release(&f->lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
evas_thread_queue_wait(void)
|
||||||
|
{
|
||||||
|
struct fence_stuff f;
|
||||||
|
|
||||||
|
/* No shortcuts here - if the thread queue looks empty it could just mean
|
||||||
|
* it's being processed. Need a round trip.
|
||||||
|
*/
|
||||||
|
if (!eina_lock_new(&f.lock)) return;
|
||||||
|
if (!eina_condition_new(&f.cond, &f.lock))
|
||||||
|
{
|
||||||
|
eina_lock_free(&f.lock);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_lock_take(&f.lock);
|
||||||
|
evas_thread_queue_flush(_evas_thread_queue_fence, &f);
|
||||||
|
eina_condition_wait(&f.cond);
|
||||||
|
eina_lock_release(&f.lock);
|
||||||
|
|
||||||
|
eina_lock_free(&f.lock);
|
||||||
|
eina_condition_free(&f.cond);
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_shutdown_timeout(double *time, int mode, int timeout_ms)
|
_shutdown_timeout(double *time, int mode, int timeout_ms)
|
||||||
{
|
{
|
||||||
|
@ -72,47 +113,6 @@ evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data)
|
||||||
evas_thread_queue_append(cb, data, EINA_TRUE);
|
evas_thread_queue_append(cb, data, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct fence_stuff {
|
|
||||||
Eina_Lock lock;
|
|
||||||
Eina_Condition cond;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
_evas_thread_queue_fence(void *data)
|
|
||||||
{
|
|
||||||
struct fence_stuff *f;
|
|
||||||
|
|
||||||
f = data;
|
|
||||||
|
|
||||||
eina_lock_take(&f->lock);
|
|
||||||
eina_condition_signal(&f->cond);
|
|
||||||
eina_lock_release(&f->lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
evas_thread_queue_wait(void)
|
|
||||||
{
|
|
||||||
struct fence_stuff f;
|
|
||||||
|
|
||||||
/* No shortcuts here - if the thread queue looks empty it could just mean
|
|
||||||
* it's being processed. Need a round trip.
|
|
||||||
*/
|
|
||||||
if (!eina_lock_new(&f.lock)) return;
|
|
||||||
if (!eina_condition_new(&f.cond, &f.lock))
|
|
||||||
{
|
|
||||||
eina_lock_free(&f.lock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
eina_lock_take(&f.lock);
|
|
||||||
evas_thread_queue_flush(_evas_thread_queue_fence, &f);
|
|
||||||
eina_condition_wait(&f.cond);
|
|
||||||
eina_lock_release(&f.lock);
|
|
||||||
|
|
||||||
eina_lock_free(&f.lock);
|
|
||||||
eina_condition_free(&f.cond);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void*
|
static void*
|
||||||
evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED)
|
evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1320,6 +1320,8 @@ Tilebuf_Rect *evas_common_regionbuf_rects_get (Regionbuf *rb);
|
||||||
|
|
||||||
void evas_font_dir_cache_free(void);
|
void evas_font_dir_cache_free(void);
|
||||||
|
|
||||||
|
EAPI void evas_thread_queue_wait(void);
|
||||||
|
|
||||||
EAPI int evas_async_events_process_blocking(void);
|
EAPI int evas_async_events_process_blocking(void);
|
||||||
void evas_render_rendering_wait(Evas_Public_Data *evas);
|
void evas_render_rendering_wait(Evas_Public_Data *evas);
|
||||||
void evas_all_sync(void);
|
void evas_all_sync(void);
|
||||||
|
@ -1328,7 +1330,6 @@ int evas_thread_init(void);
|
||||||
int evas_thread_shutdown(void);
|
int evas_thread_shutdown(void);
|
||||||
EAPI void evas_thread_cmd_enqueue(Evas_Thread_Command_Cb cb, void *data);
|
EAPI void evas_thread_cmd_enqueue(Evas_Thread_Command_Cb cb, void *data);
|
||||||
EAPI void evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data);
|
EAPI void evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data);
|
||||||
EAPI void evas_thread_queue_wait(void);
|
|
||||||
|
|
||||||
typedef enum _Evas_Render_Mode
|
typedef enum _Evas_Render_Mode
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue