summaryrefslogtreecommitdiff
path: root/src/lib/evas/common
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-04-28 11:24:48 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-04-28 18:41:39 +0900
commitb2ca7a96dcb49aec273d5655aee1140ea80464b3 (patch)
tree637d4dc41dd629e52e0b2f02499b3022ea50bb9e /src/lib/evas/common
parent26d728be01ba22900c274682838d702c3da22c84 (diff)
thread fence code - move elsewhere in file to avoid conflicts
Diffstat (limited to 'src/lib/evas/common')
-rw-r--r--src/lib/evas/common/evas_thread_render.c82
1 files changed, 41 insertions, 41 deletions
diff --git a/src/lib/evas/common/evas_thread_render.c b/src/lib/evas/common/evas_thread_render.c
index 210404227e..bbde81a657 100644
--- a/src/lib/evas/common/evas_thread_render.c
+++ b/src/lib/evas/common/evas_thread_render.c
@@ -18,6 +18,47 @@ static int init_count = 0;
18#define SHUTDOWN_TIMEOUT_CHECK (1) 18#define SHUTDOWN_TIMEOUT_CHECK (1)
19#define SHUTDOWN_TIMEOUT (3000) 19#define SHUTDOWN_TIMEOUT (3000)
20 20
21struct fence_stuff {
22 Eina_Lock lock;
23 Eina_Condition cond;
24};
25
26static void
27_evas_thread_queue_fence(void *data)
28{
29 struct fence_stuff *f;
30
31 f = data;
32
33 eina_lock_take(&f->lock);
34 eina_condition_signal(&f->cond);
35 eina_lock_release(&f->lock);
36}
37
38EAPI void
39evas_thread_queue_wait(void)
40{
41 struct fence_stuff f;
42
43 /* No shortcuts here - if the thread queue looks empty it could just mean
44 * it's being processed. Need a round trip.
45 */
46 if (!eina_lock_new(&f.lock)) return;
47 if (!eina_condition_new(&f.cond, &f.lock))
48 {
49 eina_lock_free(&f.lock);
50 return;
51 }
52
53 eina_lock_take(&f.lock);
54 evas_thread_queue_flush(_evas_thread_queue_fence, &f);
55 eina_condition_wait(&f.cond);
56 eina_lock_release(&f.lock);
57
58 eina_lock_free(&f.lock);
59 eina_condition_free(&f.cond);
60}
61
21static Eina_Bool 62static Eina_Bool
22_shutdown_timeout(double *time, int mode, int timeout_ms) 63_shutdown_timeout(double *time, int mode, int timeout_ms)
23{ 64{
@@ -72,47 +113,6 @@ evas_thread_queue_flush(Evas_Thread_Command_Cb cb, void *data)
72 evas_thread_queue_append(cb, data, EINA_TRUE); 113 evas_thread_queue_append(cb, data, EINA_TRUE);
73} 114}
74 115
75struct fence_stuff {
76 Eina_Lock lock;
77 Eina_Condition cond;
78};
79
80static void
81_evas_thread_queue_fence(void *data)
82{
83 struct fence_stuff *f;
84
85 f = data;
86
87 eina_lock_take(&f->lock);
88 eina_condition_signal(&f->cond);
89 eina_lock_release(&f->lock);
90}
91
92EAPI void
93evas_thread_queue_wait(void)
94{
95 struct fence_stuff f;
96
97 /* No shortcuts here - if the thread queue looks empty it could just mean
98 * it's being processed. Need a round trip.
99 */
100 if (!eina_lock_new(&f.lock)) return;
101 if (!eina_condition_new(&f.cond, &f.lock))
102 {
103 eina_lock_free(&f.lock);
104 return;
105 }
106
107 eina_lock_take(&f.lock);
108 evas_thread_queue_flush(_evas_thread_queue_fence, &f);
109 eina_condition_wait(&f.cond);
110 eina_lock_release(&f.lock);
111
112 eina_lock_free(&f.lock);
113 eina_condition_free(&f.cond);
114}
115
116static void* 116static void*
117evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED) 117evas_thread_worker_func(void *data EINA_UNUSED, Eina_Thread thread EINA_UNUSED)
118{ 118{