CreateThread function kernel32
Win32Result<HANDLE>
CreateThread(
- Pointer<
SECURITY_ATTRIBUTES> ? lpThreadAttributes, - int dwStackSize,
- Pointer<
NativeFunction< lpStartAddress,LPTHREAD_START_ROUTINE> > - Pointer<
NativeType> ? lpParameter, - THREAD_CREATION_FLAGS dwCreationFlags,
- Pointer<
Uint32> ? lpThreadId,
Creates a thread to execute within the virtual address space of the calling process.
To learn more, see learn.microsoft.com/windows/win32/api/processthreadsapi/nf-processthreadsapi-createthread.
Implementation
Win32Result<HANDLE> CreateThread(
Pointer<SECURITY_ATTRIBUTES>? lpThreadAttributes,
int dwStackSize,
Pointer<NativeFunction<LPTHREAD_START_ROUTINE>> lpStartAddress,
Pointer? lpParameter,
THREAD_CREATION_FLAGS dwCreationFlags,
Pointer<Uint32>? lpThreadId,
) {
final result_ = CreateThread_Wrapper(
lpThreadAttributes ?? nullptr,
dwStackSize,
lpStartAddress,
lpParameter ?? nullptr,
dwCreationFlags,
lpThreadId ?? nullptr,
);
return Win32Result(value: HANDLE(result_.value.ptr), error: result_.error);
}