sdlGetThreadName function

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

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

This is internal memory, not to be freed by the caller, and remains valid until the specified thread is cleaned up by SDL_WaitThread().

\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 2.0.0.

\sa SDL_CreateThread

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

Implementation

String? sdlGetThreadName(Pointer<SdlThread> thread) {
  final sdlGetThreadNameLookupFunction = libSdl2.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();
}