Skip to content

Commit

Permalink
bugfix: Issue #37
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudwu committed Sep 11, 2013
1 parent 80fe468 commit efb8ecb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions skynet-src/skynet_mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *
Expand All @@ -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;
}
Expand Down

0 comments on commit efb8ecb

Please sign in to comment.