pipe
pipe copied to clipboard
Number of elements in pipe
Hi, I'm trying to use pipe.c as the underlying mechanism for a Java InputStream in a JNI project.
All good - but I need a way to get the number of elements in the pipe at a specified time.
Is this possible?
You can try add function like this:
size_t pipe_bytes(pipe_generic_t * p)
{
return bytes_in_use(make_snapshot(p));
}
and then get number of elements:
elements = pipe_bytes(p) / pipe_elem_size(p);