Unified Communications Managed API version 1.0 supports multi-threaded applications. In production code, an application should use asynchronous calls whenever possible. Unified Communications Managed API version 1.0 supports this well known .NET asynchronous programming pattern. Refer to .NET Framework Developer's Guide (http://msdn2.microsoft.com/en-us/library/ms228969.aspx) for a detailed description of this pattern.

The platform uses thread pool worker threads to raise events or invoke application callbacks. A Unified Communications Managed API version 1.0 application must not throw exceptions in these worker threads because such exceptions might not be caught, and that failure would result in termination of the application.

An application is responsible for handling thread switching when dealing with the UI. For example, if the application updates UI elements in a callback or event handler, it must choose the correct UI thread. When the platform raises a MessageReceived event, it places that MessageReceived event in the queue of the appropriate incoming signaling session. If the application receives an event indicating the signaling session is disconnected, all pending events in that session's queue can be discarded. The application can immediately inform the user that the session is canceled.

The platform will not raise events or invoke application-supplied callback inside a lock block.

For more information about the fundamentals of writing multithreaded applications, see Managed Threading (http://msdn2.microsoft.com/en-us/library/).

See Also