I have basically two questions concerning CCR.
1. How can I cancel pending ReceiverTasks? Let's say that I have created some permanent Receivers and wired them up with some Port. Finally, I've posted some 1000 items to that port. I have the Cancel button on my form and now I want to cancel all pending tasks. Should I use another DispatcherQueue to preempt existing queued tasks? How can I do that?
2. I am playing with the WinFormsAdaptor and WinFormsServicePort. Inside my main method I wrote following:
static void Main()
Dispatcher dispatcher = new Dispatcher(0, "CCRDemo Threads");
DispatcherQueue dispatcherQueue = new
DispatcherQueue("CCRDemo DispatcherQueue", dispatcher);
WinFormsServicePort port =
port.Post(new RunForm(new WinFormConstructor(delegate
return new MainForm(dispatcherQueue);
MainForm displays properly and everything looks nice until I push close button on my form. Form closes but application hangs i.e. WinFormsUIThread running hidden form doesn't stop. What should I do to properly shutdown the app?
BTW, I haven't slept properly lately because of the CCR . It is so fascinating! It took me a couple hours to grasp the basics and another couple with Reflector to grasp what's really inside. One really gets productive after, basically, very short period. All my previous multithreading attempts were painful coordination between various Manual/AutoResetEvents and other mt primitives, various Queues with posted data etc. What I am trying to do now is to come up with an example where I can not use CCR. I haven't succeeded yet! CCR should definitely be a part of the next .NET version . Bravo!