Skip to content

Commit

Permalink
Linux Platform: fix the dispatch thread
Browse files Browse the repository at this point in the history
In fact since a40af2f an old bug is now
visible resulting in a 100% cpu usage.
In case we exit the wait, if there is nothing in the queue, we must not release the lock
as we are waiting again immediatelly.
  • Loading branch information
GwendalRaoul committed Feb 21, 2025
1 parent fc94c51 commit 9101378
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/platform/linux/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ static void * dispatch_indication(void * unused)
// Check if we wake up but nothing in queue
if (m_queue_empty)
{
// Release the lock
pthread_mutex_unlock(&m_queue_mutex);
// Continue to evaluate the stop condition
continue;
}
Expand Down Expand Up @@ -245,7 +243,7 @@ static void * poll_for_indication(void * unused)
free_buffer_room = m_ind_queue_read - m_ind_queue_write;
}
}

if (m_polling_thread_state_request == POLLING_THREAD_STOP_REQUESTED)
{
// In case we are about to stop, let's poll only one by one to have more chance to
Expand Down

0 comments on commit 9101378

Please sign in to comment.