Udostępnij za pośrednictwem


Win32ThreadTraits Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Win32ThreadTraits Class.

This class provides the creation function for a Windows thread. Use this class if the thread will not use CRT functions.

Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

Syntax

class Win32ThreadTraits

Members

Public Methods

Name Description
Win32ThreadTraits::CreateThread (Static) Call this function to create a thread that should not use CRT functions.

Remarks

Thread traits are classes that provide a creation function for a particular type of thread. The creation function has the same signature and semantics as the Windows CreateThread function.

Thread traits are used by the following classes:

If the thread will be using CRT functions, use CRTThreadTraits instead.

Requirements

Header: atlbase.h

Win32ThreadTraits::CreateThread

Call this function to create a thread that should not use CRT functions.

static HANDLE CreateThread(
    LPSECURITY_ATTRIBUTES lpsa,
    DWORD dwStackSize,
    LPTHREAD_START_ROUTINE pfnThreadProc,
    void* pvParam,
    DWORD dwCreationFlags,
    DWORD* pdwThreadId) throw();

Parameters

lpsa
The security attributes for the new thread.

dwStackSize
The stack size for the new thread.

pfnThreadProc
The thread procedure of the new thread.

pvParam
The parameter to be passed to the thread procedure.

dwCreationFlags
The creation flags (0 or CREATE_SUSPENDED).

pdwThreadId
[out] Address of the DWORD variable that, on success, receives the thread ID of the newly created thread.

Return Value

Returns the handle to the newly created thread or NULL on failure. Call GetLastError to get extended error information.

Remarks

See CreateThread for further information on the parameters to this function.

This function calls CreateThread to create the thread.

See Also

Class Overview