Question about CCR and WCF integration

383 Views Asked by At

Regardind this solution Using the CCR with ASynchronous WCF Service

Why do you need to do this :

ThreadPool.QueueUserWorkItem(s => callback(this));

instead of just calling callback(this) ?

Isn't QueueUserWorkItem going to use yet another thread ?

1

There are 1 best solutions below

0
On

"callback" is a method that needs to be provided as an input parameter to BeginGetAccount. In the answer it doesn't specify the "callback" method so there is no way to know if it makes use of a new thread or not and therefore it does make sense to put the "callback" method on a seperate thread in Complete.

If you could guarantee "callback" created its own thread then you wouldn't need to create one in the Complete method.