I'm not sure how Parallel.foreach's internal thread processing works, and can this guarantee that such a design will work?
Parallel.Foreach(Connections, c => { Input in = c.getInput(); while (in.hasNext()) { object o = in.getNext(); dosomething(o); } } );
where in.hasNext () just waits for an object in the input stream and returns true. Basically, I can run a bunch of infinite loops in a parallel foreach structure, ensuring that they all run at the same time.
(For the brave, can I customize this so that I can edit the connection list by adding (and removing, which should be trivial) connections, and it will still read the input of all the connections in the list).
source share