Skip to content

Commit

Permalink
Linux Platfrom: add comment to clarify indication queue lock
Browse files Browse the repository at this point in the history
It was not clear why the indication queue is not locked when checking
free space. #26
  • Loading branch information
Gwendal Raoul authored and GwendalRaoul committed Sep 14, 2020
1 parent bb9e1cc commit 823bd9d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/platform/linux/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ static void * poll_for_indication(void * unused)
// Get the lock to be able to poll
pthread_mutex_lock(&m_poll_mutex);

// Get the number of free buffers in the indication queue
// Note: No need to lock the queue as only m_ind_queue_read can be updated
// and could still be modified when we release the lock after computing
// the max free space

/* Ask for maximum room in buffer queue and less than MAX */
if (!m_queue_empty && (m_ind_queue_write == m_ind_queue_read))
{
Expand Down

0 comments on commit 823bd9d

Please sign in to comment.