In a different thread George cleared some things up for me.
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=2082590&SiteID=1
Specifically:
※Activate() is really a form of "spawn" or "execute in parallel", which is exactly what interleave needs, as a long running arbiter.§
This started me to wonder what actually gets put on a new thread and when does it happen. Of the arbiter objects created from the Arbiter static methods: (correct me if I*m wrong)
Receiver, JoinReceiver, and JoinSinglePortReceiver can persist or not persist at the user*s discretion.
Choice can only not persist.
Interleave can only persist.
Does it really take Activate to place an arbiter onto another thread Does that mean if you wrote:
Arbiter.Receive(true, _myPort, myHandler);
(1)That it would not be never fire Or, (2)would this hang and wait for the Receiver to complete within the current thread In this case, since the Receiver is persisted, it would never complete and the thread would be permenantly blocked.
If the first case is true and the Arbiter.Receive() method merely creates the Receiver object with the association between the port and the handler. Then it goes on it*s way and because there is no association to a DispatchQueue, the handler will never fire. If this is the case you would ALWAYS want to Activate, regardless of persistance.
If the second case is true and the creation of one of the arbiters always blocks until the arbiter is completed, then you always want to Activate any arbiter that persists. But, I don*t see anything wrong with Activating non-persisting arbiters, unless you just want to block. I think I*ve seen examples of using Arbiter.Choice() without an Activate. This makes sence if you want to block until one of several delegates fire.
If I understand correctly, the creation of the arbiter associates the handler to the port, but the Activate associates the arbiter to the DispatchQueue. If the second case is true and the creation of an arbiter does always block until the arbiter is complete, then the Activate must put the whole creation on to the new thread. In that case, if the arbiter persists, it will block the new thread and if it doesn*t, the new thread will terminate when the arbiter completes.
I believe I am starting to talk myself into the second argument. It seems to make more sence. Can anyone confirm this or blow it out of the water Either way would help.
Thanks,
Dogulas