Added iio_buffer_release() which enqueues the last dequeued buffer back to the kernel
PR Description
Added the iio_buffer_release() function which enqueues the last dequeued buffer back to the kernel.
This is only applicable to the local backend and when using the MMAP API.
The implementation of this function in the local backend is essentially copy-pasted from the first part of local_get_buffer().
The use of this function is totally optional and indeed only valid for local and MMAP.
The motivation for this function is when manually calling poll() or select() on the file descriptor returned by iio_buffer_get_poll_fd(). If there is only 1 kernel buffer and it hasn't yet been enqueued back to the kernel then a call to poll() will hang. This is where this function comes in handy. If you first call iio_buffer_release() then call poll() it will work.
PR Type
- [ ] Bug fix (a change that fixes an issue)
- [x] New feature (a change that adds new functionality)
- [ ] Breaking change (a change that affects other repos or cause CIs to fail)
PR Checklist
- [x] I have conducted a self-review of my own code changes
- [x] I have commented new code, particularly complex or unclear areas
- [x] I have checked that I did not introduce new warnings or errors (CI output)
- [x] I have checked that components that use libiio did not get broken
- [x] I have updated the documentation accordingly (GitHub Pages, READMEs, etc)
i think that static code analysis tool is buggy. it's complaining that release_buffer is never used which is clearly wrong.
As @nunojsa mentioned, libiio-v0 has moved to maintenance mode. We’ll continue to take bug fixes, but we’re not accepting feature requests, enhancements, or API changes.