Re: thread marshalling error
Rohit Kumar <RohitKumar@discussions.microsoft.com> wrote:
Instead i did CoInitializeEx(NULL,COINIT_MULTITHREADED) and my
program worked fine. Is there any after effects of this usage???
If you expect any callbacks from the server (e.g. it fires events to
you), they will arrive on threads created by COM runtime, concurrently
with whatever other work you might be doing. Your program must be
thread-safe to account for that.
When calling out from an STA apartment, COM spins a modal message pump
while the call is in progress. This allows your windows to repaint, for
example. When calling out from MTA, the thread is simply suspended until
the call returns. If you do it from a UI thread, your application will
Also I had started my thread as
how should i end my thread??
Simply return from WorkerThreadProc.
With best wishes,
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925