First question (receiver de-activation):
Hi, there are 3 ways to de-activate a receiver:
1) make the receiver one time, and the CCR will remove it after it processes one message, and it will do so automatically and atomically
2) use Arbiter.Choice to coordinate between receivers and the CCR will again remove all receivers after the first receiver executes
3) use Interleave and the TeardownReceiverGroup, and when a receiver in the group executes all other receivers will be removed
Ok there is actually one more way but its low level and youhave to be carefull when to use. If you look at the port API itself there is a Register and Unregister receiver, if you want to take matters on your own hands
Second question: Serializing calls
I strongly recommend to not use any calls to traditional thread locking APIS with the CCR. Use interleave, join constructs, activate one time receivers and then re-register them etc, to achieve serialization. Interleave is the most intuitive and takes care of alot of conditions.
There are actually a few ways to achieve serialization with a system like the CCR, depending on what you are trying to do, but again interleave should allow you with a couple of lines, to serialize all access to apiece of code, even across asychnronous continuations (if the exclusive receiver is an iterator)
hope this helps
Thanks a lot! I had a feeling that CLR thrddaing locking doesn't sound right!
One more question:
How does CCR works across domains? Can I register a receiver which is a callback to a remoting object and will be executed in a different domain? Do you see any problems in this scenario