bofc manual pages
Function rb_discard(3) will remove count elements from rb buffer. This functions is very similar to calling rb_read(3) and then discarding buffer, but this function is much better because when discarding with rb_discard(3) there is no copying involved, so it's much faster. You can pass more count then there is in the buffer. Function never blocks calling thread.
Note, it is very difficult to discard data in multi-threaded environment with more than one reader per se. Thus it is inadvisible to use this function when there are two or more readers using same rb object.
Function will return number of elements actually discarded fomr buffer. It is ok for function to return less elements than it was passed in count variable. This means there was less elements in rb than requested to be discarded. On errors -1 is returned.
- rb is not a valid object.
rb_overview(7), rb_new(3), rb_init(3), rb_destroy(3), rb_cleanup(3), rb_stop(3), rb_stop_signal(3), rb_read(3), rb_recv(3), rb_write(3), rb_send(3), rb_posix_read(3), rb_posix_recv(3), rb_posix_write(3), rb_posix_send(3), rb_clear(3), rb_count(3), rb_space(3), rb_header_size(3), rb_array_size(3), rb_version(3)
23 October 2018 (v1.1.0)