When you have a multi-threaded client where multiple threads are using the same context handle, the calls will be serialized at the server. This saves the server manager from having to guard against another thread from the same client changing the context or from the context running down while a call is dispatched. However, in certain cases serialization may create deadlock. For example, consider the following sequence:
Thread 1 : Gets a context handle and makes a call. This call blocks on some synchronization event sitting on the server.
Thread 2 : Makes a call to the same server, using the same context handle. This call is intended to trigger the event thread 1 is blocking on. Because the calls are serialized, the event is never triggered.
If you have a situation like this you can use the RpcSsDontSerializeContext function to allow multiple calls to be dispatched on a single context handle. Calling this function does not disable serialization entirely—when a context rundown occurs, your context rundown routine will not run until all outstanding client requests have completed. Also, consider carefully the potential effects of the close routine in the server's context rundown being serialized. Finally, be aware that a call to RpcScDontSerializeContext affects the entire process and is unrevertable.