Skip to content

Commit

Permalink
!2398 fix message queue concurrent bug
Browse files Browse the repository at this point in the history
From: @jikai11 
Reviewed-by: @xuxuepeng 
Signed-off-by: @xuxuepeng
  • Loading branch information
openeuler-ci-bot authored and gitee-org committed Apr 2, 2024
2 parents 8504a6b + f90a145 commit 4732e0b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/daemon/mailbox/message_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,12 @@ message_queue *message_queue_create(void (*release)(void *))
return NULL;
}

bq = blocking_queue_create(BLOCKING_QUEUE_NO_TIMEOUT, release);
if (bq == NULL) {
mq->messages = blocking_queue_create(BLOCKING_QUEUE_NO_TIMEOUT, release);
if (mq->messages == NULL) {
ERROR("Failed to create events queue");
return NULL;
}
bq = mq->messages;

mq->subscribers = map_new(MAP_PTR_INT, MAP_DEFAULT_CMP_FUNC, message_queue_subscriber_free);
if (mq->subscribers == NULL) {
Expand All @@ -131,7 +132,7 @@ message_queue *message_queue_create(void (*release)(void *))
return NULL;
}

mq->messages = isula_transfer_ptr(bq);
bq = NULL;
return isula_transfer_ptr(mq);
}

Expand Down

0 comments on commit 4732e0b

Please sign in to comment.