mirror of
https://github.com/openharmony/distributedschedule_samgr_lite.git
synced 2026-07-19 09:03:40 -04:00
modify lock race condition
Signed-off-by: caochao <caochao@huawei.com> Change-Id: Id88cab569dc0850f9e3cd1c300b213bc0325d384
This commit is contained in:
Executable → Regular
+1
-1
@@ -65,11 +65,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) {
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&queue->rMutex);
|
||||
while (LFQUE_Pop(queue->queue, element, pri) != EC_SUCCESS) {
|
||||
pthread_cond_wait(&queue->cond, &queue->rMutex);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user