Share via


CoGetCurrentProcess

This function returns a value that is unique to the current thread. CoGetCurrentProcess can be used to avoid thread ID reuse problems.

DWORD CoGetCurrentProcess(void);

Parameters

None.

Return Values

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

OS Versions: Windows CE 3.0 and later.
Header: Objbase.h.
Link Library: Ole32.lib.

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.