sdlGetThreadName function

String? sdlGetThreadName(
  1. Pointer<SdlThread> thread
)

Get the thread name as it was specified in SDL_CreateThread().

\param thread the thread to query. \returns a pointer to a UTF-8 string that names the specified thread, or NULL if it doesn't have a name.

\since This function is available since SDL 3.1.3.

extern SDL_DECLSPEC const char * SDLCALL SDL_GetThreadName(SDL_Thread *thread)

Implementation

String? sdlGetThreadName(Pointer<SdlThread> thread) {
  final sdlGetThreadNameLookupFunction = libSdl3.lookupFunction<
      Pointer<Utf8> Function(Pointer<SdlThread> thread),
      Pointer<Utf8> Function(Pointer<SdlThread> thread)>('SDL_GetThreadName');
  final result = sdlGetThreadNameLookupFunction(thread);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}