CoGetCurrentProcess
A version of this page is also available for
4/8/2010
This function returns a value that is unique to the current thread. CoGetCurrentProcess can be used to avoid thread ID reuse problems.
Syntax
DWORD CoGetCurrentProcess(void);
Parameters
None.
Return Value
Unique DWORD value identifying the current thread.
Remarks
Using the value returned from a call to CoGetCurrentProcess can help you in maintaining tables that are keyed by threads or in uniquely identifying a thread to other threads or processes.
The CoGetCurrentProcess function returns a value that is effectively unique, because it is not used again until 232 more threads have been created on the current workstation or until the workstation is restarted.
The value returned by CoGetCurrentProcess will uniquely identify the same thread for the life of the caller. Because thread IDs can be reused without notice as threads are created and destroyed, this value is more reliable than the DWORD returned by the Win32 function GetCurrentThreadId.
To determine whether the platform supports this function, see Determining Supported COM APIs.
Requirements
Header | objbase.h |
Library | ole32.lib |
Windows Embedded CE | Windows CE 3.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |