sdlTlsSet function

int sdlTlsSet(
  1. int id,
  2. Pointer<NativeType> value,
  3. Pointer<NativeType> deor
)

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

The function prototype for destructor is:

void destructor(void *value)

where its parameter value is what was passed as value to SDL_TLSSet().

\param id the thread local storage ID \param value the value to associate with the ID for the current thread \param destructor a function called when the thread exits, to free the value \returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.

\since This function is available since SDL 2.0.0.

\sa SDL_TLSCreate \sa SDL_TLSGet

extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*))

Implementation

int sdlTlsSet(int id, Pointer<NativeType> value, Pointer<NativeType> deor) {
  final sdlTlsSetLookupFunction = libSdl2.lookupFunction<
      Int32 Function(
          Uint32 id, Pointer<NativeType> value, Pointer<NativeType> deor),
      int Function(int id, Pointer<NativeType> value,
          Pointer<NativeType> deor)>('SDL_TLSSet');
  return sdlTlsSetLookupFunction(id, value, deor);
}