I am using a separat thread to read a iio buffer with iio_buffer_refill. When there is not data in the buffer for a duration larger than the timeout, I get a "timeout" return value which is ok. However when I try calling iio_buffer_refill after that I get a "bad file descriptor" error and I need to close to buffer to get out of this state.
Is this the intended behaviour or a bug?
My current workaround is to make the timeout super long, so that the timeout is practically never reached. But in order to join the buffer-read thread, I need to call iio_buffer_cancel from the outside thread now to make the buffer-read thread join. I don't know if iio_buffer_cancel is thread safe or not. (I did not experience a crash so far).