/* Read one element out of the buffer. 
This function will return the element located at the array index of the read pointer, and then increment the read pointer index. This function checks for an overflow and corrects read pointer if required. */
bool tu_fifo_read(tu_fifo_t *f, void *buffer)
/* Read one element out of the buffer. 
This function will return the element located at the array index of the read pointer, and then increment the read pointer index. This function checks for an overflow and corrects read pointer if required. */
bool tu_fifo_read(tu_fifo_t *f, void *buffer)
{
  _ff_lock(f->mutex_rd);
  bool ret = _tu_fifo_peek(f, buffer, f->wr_idx, f->rd_idx);
  f->rd_idx = advance_index(f->depth, f->rd_idx, ret);
  _ff_unlock(f->mutex_rd);
  return ret;
}