A somewhat similar question to this was raised here Channel Monitoring Statistics. I want to use remote channels as if they were regular buffers, e.g. Circular Buffers from DataStructures.jl, however those are difficult to share between workers without a lot of function calls, copying and memory overhead. I use RemoteChannels because they are naturally shared and reference-able, and are a form of buffer.
I simply need to know how many objects are in each remote channel because I only wish to start taking data when my channel is full. isready()
returns true when there is only one object in the channel, which is no good to me. I need an isfull()
method, or better still a length()
method. Does anyone know how to do this? (I realise I can count them using take!()
until isready = false
and then put them all back, but I need to check the length millions of times a second across about 50 channels.)
Edit: My use case is a pseudo real-time monitoring and control system where I am taking many measurements from a dynamical system and need to have a simple noise filter across e.g. 50 streams of data and the filter requires me to store state but I can never know which measurement will be sampled next, so that I need to choose the appropriate buffer/channel for that data stream each time.