diff --git a/samgr/adapter/posix/queue_adapter.c b/samgr/adapter/posix/queue_adapter.c index da7f0319479d0f14a33acb55adcde10e8b8018d9..376296e8120b9010c41130fef410152e29849b6c 100644 --- a/samgr/adapter/posix/queue_adapter.c +++ b/samgr/adapter/posix/queue_adapter.c @@ -67,9 +67,11 @@ int QUEUE_Pop(MQueueId queueId, void *element, uint8 *pri, int timeout) LockFreeBlockQueue *queue = (LockFreeBlockQueue *)queueId; pthread_mutex_lock(&queue->rMutex); if (LFQUE_Pop(queue->queue, element, pri) == EC_SUCCESS) { + pthread_mutex_unlock(&queue->rMutex); return EC_SUCCESS; } + pthread_mutex_lock(&queue->rMutex); while (LFQUE_Pop(queue->queue, element, pri) != EC_SUCCESS) { pthread_cond_wait(&queue->cond, &queue->rMutex); }