Hello,
I was thinking about adding CSP-style select as in Go to Java using HawtDispatch. A select in Go allows you to wait on several blocking channels till an item is added to any of the blocking channels. The select would then jump to the handler that serves the blocking channel an item was added to. See for example this sample snippet:
https://gobyexample.com/selectWhen looking at HawtDispatch my first thought was that Dispatch Sources correspond to this idea, because when looking at
http://hawtdispatch.fusesource.org/#NIO_Dispatch_Source you see that an event handler is registered with the queue (indirectly through a channel). But when looking at class SelectableChannel I see that they have tons of methods and I can't see the forest for the trees about how to use such a SelectableChannel in order to get a CSP-style select accomplished.
I think it wouldn't be hard to implement CSP-style select for HawtDispatch on my own. But I would first like to ask whether SelectableChannels can be used in some way to achieve this. Otherwise, it would be a fun little project to implement it for HawtDispatch.
Cheers, Oliver