#pragma section-numbers off #pragma camelcase off || DRAFT|| ##*^*^*^*^*See http://wiki.libsdl.org/moin.cgi/SGFunctions for details on editing this page*^*^*^*^* = SDL_TLSCreate = Use this function to create an identifier that is globally visible to all threads but refers to data that is thread-specific. <> == Syntax == {{{#!highlight cpp SDL_TLSID SDL_TLSCreate(void) }}} == Return Value == Returns the newly created thread local storage identifier or 0 on error. == Code Examples == {{{#!highlight cpp static SDL_SpinLock tls_lock; static SDL_TLSID thread_local_storage; void SetMyThreadData(void *value) { if (!thread_local_storage) { SDL_AtomicLock(&tls_lock); if (!thread_local_storage) { thread_local_storage = SDL_TLSCreate(); } SDL_AtomicUnlock(&tls_lock); } SDL_TLSSet(thread_local_storage, value, 0); } void *GetMyThreadData(void) { return SDL_TLSGet(thread_local_storage); } }}} == Remarks == ''You can add useful comments here'' ##Leave this section as-is unless you have a remark to put in. In that case, replace ''You can add useful comments here'' with your remark(s) following the Style Guide instructions. Leave the rest of the markup alone and delete this comment. == Version == This function is available since SDL 2.0.0. == Related Functions == .[[SDL_TLSGet]] .[[SDL_TLSSet]] ---- [[CategoryAPI]], [[CategoryThread]] ##See the Style Guide for instructions on editing the footer.