sdlCreateThreadRuntime function
Pointer<SdlThread>
sdlCreateThreadRuntime(
- Pointer<
NativeFunction< fn,SdlThreadFunction> > - String? name,
- Pointer<
NativeType> data, - Pointer<
NativeType> pfnBeginThread, - Pointer<
NativeType> pfnEndThread,
The actual entry point for SDL_CreateThread.
\param fn the SDL_ThreadFunction function to call in the new thread
\param name the name of the thread
\param data a pointer that is passed to fn
\param pfnBeginThread the C runtime's _beginthreadex (or whatnot). Can be NULL.
\param pfnEndThread the C runtime's _endthreadex (or whatnot). Can be NULL.
\returns an opaque pointer to the new thread object on success, NULL if the
new thread could not be created; call SDL_GetError() for more
information.
\since This function is available since SDL 3.1.3.
extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadRuntime(SDL_ThreadFunction fn, const char *name, void *data, SDL_FunctionPointer pfnBeginThread, SDL_FunctionPointer pfnEndThread)
Implementation
Pointer<SdlThread> sdlCreateThreadRuntime(
Pointer<NativeFunction<SdlThreadFunction>> fn,
String? name,
Pointer<NativeType> data,
Pointer<NativeType> pfnBeginThread,
Pointer<NativeType> pfnEndThread) {
final sdlCreateThreadRuntimeLookupFunction = libSdl3.lookupFunction<
Pointer<SdlThread> Function(
Pointer<NativeFunction<SdlThreadFunction>> fn,
Pointer<Utf8> name,
Pointer<NativeType> data,
Pointer<NativeType> pfnBeginThread,
Pointer<NativeType> pfnEndThread),
Pointer<SdlThread> Function(
Pointer<NativeFunction<SdlThreadFunction>> fn,
Pointer<Utf8> name,
Pointer<NativeType> data,
Pointer<NativeType> pfnBeginThread,
Pointer<NativeType> pfnEndThread)>('SDL_CreateThreadRuntime');
final namePointer = name != null ? name.toNativeUtf8() : nullptr;
final result = sdlCreateThreadRuntimeLookupFunction(
fn, namePointer, data, pfnBeginThread, pfnEndThread);
calloc.free(namePointer);
return result;
}