> Is there a corollary to select statements?
I've added a restricted select feature to the cpp-channel library.
It's based on concurrency primitives (i.e. condition variables) that
can also be found in languages such as Java. But I am not aware of
another implementation along those lines.
Overall, cpp::internal::_channel<T, N> is succinct but nontrivial
code. So it's not really a corollary but more likely a candidate for
its own proof. Coincidentally, there are lots of comments and
assertions for those who, like me, are interested in formal
verification. In the absence of such a proof, bug reports and/or fixes
are welcome. But note that the case where both ends of a channel are
inside a select statement is currently unsupported. I haven't had time
yet to think about how the design has to change to add this feature
but I suspect this fairly recent paper by Gavin Lowe [1] can give
further insights.
As Ian's earlier comment suggest (and I agree), getting these things
right (and perform well) is difficult. By design, the performance of
cpp-channel is largely determined by the underlying C++11 thread
implementation (e.g. Pthreads) and thread management by the user (e.g.
thread pools). While this means that cpp-channel benefits from regular
upstream improvements, it can be equally a limiting factor due to
generality requirements on C++ standard libraries. But source code is
available for those who are interested in these sort of things.
With kind regards,
Alex
[1]
http://www.cs.ox.ac.uk/people/bernard.sufrin/CSO/alt.pdf