To avoid accessing async task conflict in obtaining and releasing async task process, disable async poll state before free the async task.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- src/uadk_async.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/uadk_async.c b/src/uadk_async.c index 86aa9e5..dfac1cb 100644 --- a/src/uadk_async.c +++ b/src/uadk_async.c @@ -117,6 +117,9 @@ static void async_poll_task_free(void) int error; struct async_poll_task *task;
+ /* Disable async poll state first */ + uadk_e_set_async_poll_state(DISABLE_ASYNC_POLLING); + error = pthread_mutex_lock(&poll_queue.async_task_mutex); if (error != 0) return; @@ -127,8 +130,6 @@ static void async_poll_task_free(void)
poll_queue.head = NULL;
- uadk_e_set_async_poll_state(DISABLE_ASYNC_POLLING); - pthread_mutex_unlock(&poll_queue.async_task_mutex); sem_destroy(&poll_queue.empty_sem); sem_destroy(&poll_queue.full_sem);