Partager via


CoGetCurrentProcess (Compact 2013)

3/26/2014

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 computer or until the computer 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

See Also

Reference

COM Functions