Skip to content

Commit bff386f

Browse files
committed
fix a bug in bh queue
1 parent 9b2609b commit bff386f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

core/shared/utils/bh_queue.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,15 @@ bh_queue_destroy(bh_queue *queue)
9696
bool
9797
bh_post_msg2(bh_queue *queue, bh_queue_node *msg)
9898
{
99+
bh_queue_mutex_lock(&queue->queue_lock);
100+
99101
if (queue->cnt >= queue->max) {
100102
queue->drops++;
101103
bh_free_msg(msg);
104+
bh_queue_mutex_unlock(&queue->queue_lock);
102105
return false;
103106
}
104107

105-
bh_queue_mutex_lock(&queue->queue_lock);
106-
107108
if (queue->cnt == 0) {
108109
bh_assert(queue->head == NULL);
109110
bh_assert(queue->tail == NULL);

0 commit comments

Comments
 (0)