From efb8ecbe845ddc308130350d2b193f3b95c35847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E9=A3=8E?= Date: Wed, 11 Sep 2013 17:21:05 +0800 Subject: [PATCH] bugfix: Issue #37 --- skynet-src/skynet_mq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skynet-src/skynet_mq.c b/skynet-src/skynet_mq.c index 5484498d..5ab17ca5 100644 --- a/skynet-src/skynet_mq.c +++ b/skynet-src/skynet_mq.c @@ -56,7 +56,6 @@ skynet_globalmq_push(struct message_queue * queue) { q->queue[tail] = queue; __sync_synchronize(); q->flag[tail] = true; - __sync_synchronize(); } struct message_queue * @@ -72,12 +71,13 @@ skynet_globalmq_pop() { return NULL; } + __sync_synchronize(); + struct message_queue * mq = q->queue[head_ptr]; if (!__sync_bool_compare_and_swap(&q->head, head, head+1)) { return NULL; } q->flag[head_ptr] = false; - __sync_synchronize(); return mq; }