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