CoAddRefServerProcess
Increments a
global per-process reference count.
ULONG CoAddRefServerProcess(void);
Return Values
S_OK
The CLSID was
retrieved successfully.
Remarks
Servers can
call CoAddRefServerProcess to increment a global per-process reference
count. This function is particularly helpful to servers that are implemented
with multiple threads, either multi-apartmented or free-threaded. Servers of
these types must coordinate the decision to shut down with activation requests across
multiple threads. Calling CoAddRefServerProcess increments a global
per-process reference count, and calling CoReleaseServerProcess
When that
count reaches zero, OLE automatically calls CoSuspendClassObjects
The simplest
way for a local server application to make use of these API functions is to
call CoAddRefServerProcess in the constructor for each of it s instance
objects, and in each of its IClassFactory::LockServer
typically means that it should signal its various threads to exit their
message loops and call CoRevokeClassObject and CoUninitialize .
If these APIs
are used at all, they must be called in both the object instances and the LockServer
method, otherwise the server application may be shut down prematurely.
In-process servers typically should not call CoAddRefServerProcess or CoReleaseServerProcess.
See Also