AnsweredAssumed Answered

multiple iio_buffer_destroy calls

Question asked by ENGINEER on May 23, 2017
Latest reply on May 23, 2017 by pcercuei


    I am trying to do multiple buffer capture with this loop


for(indx = 0;indx < NUM_IIO_BUFFERS; indx++)
   // Refill RX buffer
   nbytes_rx = iio_buffer_refill(rxbuf);

         --------------copy the rxbuff contents to another list -----


now, when doing shutdown, its only one shutdown


for(indx = 0;indx < NUM_IIO_BUFFERS; indx++)


calling iio_buffer_destroy twice throws double free or illegal pointer. 

so question is

1. does iio_buffer_destroy function call knows that there are NUM_IIO_BUFFERS to destroy by virtue of this


iio_device_set_kernel_buffers_count(rx,NUM_IIO_BUFFERS) ?

2, in other words, do i need to call the iio_buffer_destroy only once ? not NUM_IIO_BUFFERS times ?