usleep((rand() % 10) * 1000);
msg = eina_thread_queue_send(thq1, sizeof(Msg), &ref);
+ if (!msg) fail();
msg->value = val;
memset(msg->pad, 0x32, 10);
eina_thread_queue_send_done(thq1, ref);
void *ref;
msg = eina_thread_queue_wait(thq1, &ref);
+ if (!msg) fail();
val = msg->value;
usleep((rand() % 20) * 1000);
eina_thread_queue_wait_done(thq1, ref);
msg = eina_thread_queue_send(thq2, sizeof(Msg), &ref);
+ if (!msg) fail();
msg->value = val;
memset(msg->pad, 0x32, 10);
eina_thread_queue_send_done(thq2, ref);
ecore_init();
thq1 = eina_thread_queue_new();
+ if (!thq1) fail();
thq2 = eina_thread_queue_new();
+ if (!thq2) fail();
ecore_thread_feedback_run(th1_do, NULL, NULL, NULL, NULL, EINA_TRUE);
ecore_thread_feedback_run(th2_do, NULL, NULL, NULL, NULL, EINA_TRUE);
Msg *msg;
void *ref;
msg = eina_thread_queue_wait(thq2, &ref);
+ if (!msg) fail();
if (DEBUG) printf("V: %i [%i]\n", msg->value, eina_thread_queue_pending_get(thq2));
if (msg->value != (val + 1))
{
{
Msg2 *msg;
void *ref;
- int i;
+ int i, mcount;
eina_init();
ecore_init();
thq1 = eina_thread_queue_new();
+ if (!thq1) fail();
ecore_thread_feedback_run(thspeed1_do, NULL, NULL, NULL, NULL, EINA_TRUE);
for (i = 0; i < 10000000; i++)
{
msg = eina_thread_queue_send(thq1, sizeof(Msg2), &ref);
+ if (!msg) fail();
if (msg) eina_thread_queue_send_done(thq1, ref);
}
- if (msgs < 1000000)
+ mcount = msgs;
+ if (mcount < 1000000)
{
printf("ERR: not enough messages recieved\n");
fail();
void *ref;
msg = eina_thread_queue_send(thq1, sizeof(Msg3), &ref);
+ if (!msg) fail();
msg->value = val;
eina_thread_queue_send_done(thq1, ref);
val++;
void *ref;
msg = eina_thread_queue_send(thq2, sizeof(Msg3), &ref);
+ if (!msg) fail();
msg->value = val;
eina_thread_queue_send_done(thq2, ref);
val++;
ecore_init();
thq1 = eina_thread_queue_new();
+ if (!thq1) fail();
thq2 = eina_thread_queue_new();
+ if (!thq2) fail();
thqmaster = eina_thread_queue_new();
+ if (!thqmaster) fail();
eina_thread_queue_parent_set(thq1, thqmaster);
eina_thread_queue_parent_set(thq2, thqmaster);
Eina_Thread_Queue *thq;
Msg3 *msg;
void *ref;
+
sub = eina_thread_queue_wait(thqmaster, &ref);
thq = sub->queue;
eina_thread_queue_wait_done(thqmaster, ref);
+
msg = eina_thread_queue_wait(thq, &ref);
if (DEBUG) printf("V %09i: %p - %i [%i]\n", cnt, thq, msg->value, eina_thread_queue_pending_get(thqmaster));
if (thq == thq1)
eina_init();
ecore_init();
thq1 = eina_thread_queue_new();
+ if (!thq1) fail();
ecore_thread_feedback_run(th31_do, NULL, NULL, NULL, NULL, EINA_TRUE);
ecore_thread_feedback_run(th32_do, NULL, NULL, NULL, NULL, EINA_TRUE);
for (;;)
void *ref;
msg = eina_thread_queue_wait(thq1, &ref);
+ if (!msg) fail();
val = msg->value;
usleep((rand() % 20) * 1000);
eina_thread_queue_wait_done(thq1, ref);
+
msg = eina_thread_queue_send(thq2, sizeof(Msg5), &ref);
+ if (!msg) fail();
msg->value = val;
eina_thread_queue_send_done(thq2, ref);
if (val == 1100) break;
ecore_init();
thq1 = eina_thread_queue_new();
+ if (!thq1) fail();
thq2 = eina_thread_queue_new();
+ if (!thq2) fail();
ecore_thread_feedback_run(th41_do, NULL, NULL, NULL, NULL, EINA_TRUE);
ecore_thread_feedback_run(th42_do, NULL, NULL, NULL, NULL, EINA_TRUE);
} Msg6;
static Eina_Spinlock msgnum_lock;
-static int msgnum = 0;
+static volatile int msgnum = 0;
static void
th51_do(void *data EINA_UNUSED, Ecore_Thread *th EINA_UNUSED)
void *ref;
msg = eina_thread_queue_send(thq1, sizeof(Msg6), &ref);
+ if (!msg) fail();
msg->value = val;
eina_thread_queue_send_done(thq1, ref);
val++;
Msg6 *msg;
void *ref;
msg = eina_thread_queue_wait(thq1, &ref);
+ if (!msg) fail();
if (DEBUG) printf("v %08i: %i [%i]\n", cnt, msg->value, eina_thread_queue_pending_get(thq1));
eina_thread_queue_wait_done(thq1, ref);
cnt++;
eina_spinlock_take(&msgnum_lock);
msgnum++;
+ if (msgnum == 10000)
+ {
+ eina_spinlock_release(&msgnum_lock);
+ break;
+ }
eina_spinlock_release(&msgnum_lock);
}
}
Msg6 *msg;
void *ref;
msg = eina_thread_queue_wait(thq1, &ref);
+ if (!msg) fail();
if (DEBUG) printf("v %08i: %i [%i]\n", cnt, msg->value, eina_thread_queue_pending_get(thq1));
eina_thread_queue_wait_done(thq1, ref);
cnt++;
eina_spinlock_take(&msgnum_lock);
msgnum++;
+ if (msgnum == 10000)
+ {
+ eina_spinlock_release(&msgnum_lock);
+ break;
+ }
eina_spinlock_release(&msgnum_lock);
}
}
eina_spinlock_new(&msgnum_lock);
thq1 = eina_thread_queue_new();
+ if (!thq1) fail();
ecore_thread_feedback_run(th51_do, NULL, NULL, NULL, NULL, EINA_TRUE);
ecore_thread_feedback_run(th52_do, NULL, NULL, NULL, NULL, EINA_TRUE);
ecore_thread_feedback_run(th53_do, NULL, NULL, NULL, NULL, EINA_TRUE);
ecore_init();
thq1 = eina_thread_queue_new();
+ if (!thq1) fail();
if (pipe(p) != 0)
{
printf("ERR: pipe create fail\n");