summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-08-05 14:35:41 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2016-08-05 14:35:41 +0900
commit720f17619e21e53ed759cf27c3b68ef4f47f49cf (patch)
treedd32c5be1efe083711e23bcacf147ee8be7e1ccd /src/tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c
parent6b6823e5af645929264551f806f2defff576602d (diff)
ecore eina threadqueue test suite - be correct about volatile+padding
fill in the padding of mesages (10 bytes) with something so valgrinds can be happy and use vlatiole for msgs count as the msgs num should have been incremented already before the msg sned is done and main thread/loop gets the msg
Diffstat (limited to '')
-rw-r--r--src/tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c b/src/tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c
index fe5e32a44b..07b8a73d27 100644
--- a/src/tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c
+++ b/src/tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c
@@ -36,6 +36,7 @@ th1_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
36 usleep((rand() % 10) * 1000); 36 usleep((rand() % 10) * 1000);
37 msg = eina_thread_queue_send(thq1, sizeof(Msg), &ref); 37 msg = eina_thread_queue_send(thq1, sizeof(Msg), &ref);
38 msg->value = val; 38 msg->value = val;
39 memset(msg->pad, 0x32, 10);
39 eina_thread_queue_send_done(thq1, ref); 40 eina_thread_queue_send_done(thq1, ref);
40 if (val == 1000) break; 41 if (val == 1000) break;
41 val++; 42 val++;
@@ -56,8 +57,10 @@ th2_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
56 val = msg->value; 57 val = msg->value;
57 usleep((rand() % 20) * 1000); 58 usleep((rand() % 20) * 1000);
58 eina_thread_queue_wait_done(thq1, ref); 59 eina_thread_queue_wait_done(thq1, ref);
60
59 msg = eina_thread_queue_send(thq2, sizeof(Msg), &ref); 61 msg = eina_thread_queue_send(thq2, sizeof(Msg), &ref);
60 msg->value = val; 62 msg->value = val;
63 memset(msg->pad, 0x32, 10);
61 eina_thread_queue_send_done(thq2, ref); 64 eina_thread_queue_send_done(thq2, ref);
62 if (val == 1000) break; 65 if (val == 1000) break;
63 } 66 }
@@ -101,7 +104,7 @@ typedef struct
101 int ops[1]; 104 int ops[1];
102} Msg2; 105} Msg2;
103 106
104static int msgs = 0; 107static volatile int msgs = 0;
105 108
106static void 109static void
107thspeed1_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED) 110thspeed1_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
@@ -114,8 +117,8 @@ thspeed1_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
114 msg = eina_thread_queue_wait(thq1, &ref); 117 msg = eina_thread_queue_wait(thq1, &ref);
115 if (msg) 118 if (msg)
116 { 119 {
117 eina_thread_queue_wait_done(thq1, ref);
118 msgs++; 120 msgs++;
121 eina_thread_queue_wait_done(thq1, ref);
119 } 122 }
120 if (msgs == 10000000) 123 if (msgs == 10000000)
121 { 124 {