sdlGetTls function thread

Get the current thread's value associated with a thread local storage ID.

\param id a pointer to the thread local storage ID, may not be NULL. \returns the value associated with the ID for the current thread or NULL if no value has been set; call SDL_GetError() for more information.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.2.0.

\sa SDL_SetTLS

extern SDL_DECLSPEC void * SDLCALL SDL_GetTLS(SDL_TLSID *id)

Implementation

Pointer<NativeType> sdlGetTls(Pointer<SdlAtomicInt> id) {
  final sdlGetTlsLookupFunction = _libSdl
      .lookupFunction<
        Pointer<NativeType> Function(Pointer<SdlAtomicInt> id),
        Pointer<NativeType> Function(Pointer<SdlAtomicInt> id)
      >('SDL_GetTLS');
  return sdlGetTlsLookupFunction(id);
}