Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

COM Threads and Processes (Windows CE 5.0)

Windows CE 5.0
Send Feedback

In the Minimal COM implementation, Windows CE does not support concurrency management, which means that your application is responsible for synchronizing access to various objects.

Multiple threads should not access ActiveX controls, which have thread affinity because of their use of thread-specific resources.

Because the COM implementation does not support apartment threading, you cannot implement data synchronization with an apartment-threaded singleton. Instead, you must make explicit calls to thread-synchronization primitives to help protect member and global data.

This restriction does not apply to the DCOM implementation.

Specifying the Threading Model

If the ThreadingModel registry key is not set, the threading model defaults to "Free."

However, because DCOM on Windows CE supports all threading models and interactions between apartments in the same way that Windows NT does, your application must set this registry key.

In particular, for proxy objects, you must set the ThreadingModel value to "Both," which means that both single-threaded and multithreaded apartment types are supported. If you fail to do this and a thread that belongs to a different apartment accesses the proxy object, the DCOM run-time attempts to marshal the object and fails.

In Windows NT, if the ThreadingModel registry key is not set, the threading model defaults to "Single." In Windows CE, you must specify the Single threading model explicitly.

The following table summarizes the registry settings for Windows CE and Windows NT.

Windows CE registry keyWindows NT registry keyThreading model
Singledefault (not set)Main single-threaded apartment
ApartmentApartmentSingle-threaded apartment
default (not set)FreeFree threading
BothBothSupports both single-threaded and multithreaded apartment models

Thread/Process Affinity and Protected Server Libraries

The DCOM implementation requires every object to have thread/process affinity.

This means that threads that are within protected server libraries (PSLs) cannot create or access objects or APIs that are within a DCOM application and that also require an explicit concurrency model (that is, objects that must be initialized with a call to the CoInitializeEx function).

Specifically, this restriction applies to every callback that the OS makes to an application, and DLL initialization or termination functions, and any call to a device driver.

See Also

COM and DCOM Application Development


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show:
© 2015 Microsoft