It occurred to me the other day when playing with a message based application that it would be nice to have a general purpose way to perform message fan-in synchronization of asynchronous messages arriving on N ports. This is a relatively trivial convenience block, but can be used widely to simplify the logic of any block seeking to operate on N arriving messages at a time, allowing it to instead operate on an N-tuple produced by this block removing the need for any custom buffering or synchronization logic within an application or algorithm specific block. Hopefully this will be useful to others as well. The only remaining issues with this block are that it currently does not support providing back-pressure upstream, instead the std::deque’s currently grow unbounded. There is unfortunately not a great way to provide back-pressure when implementing message handlers with boost::bind, blocking in the handler is not a good option as I believe it would result in deadlock, this may be an interesting case where we need a work function operating directly on the native pmt message queues to allow them to provide back-pressure. However in the current scheduler we do not provide support for calling work() in the block thread context in the absence of any stream ports. This should be a good toy problem to help push the scheduler forward. Possible resolutions are, allowing some kind of work function which is called without any stream ports to allow checking async input buffers, or allowing the definition of some kind of handler function which allows checking or not consuming an item from an input message buffer.
Pull request @ https://github.com/gnuradio/gnuradio/pull/330