MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / pthread_key_create

Function pthread_key_create

vm/ByteCodeTranslator/src/cn1_win_compat.c:96–105  ·  view source on GitHub ↗

--- thread local storage --- Keys are stored as (TLS index + 1) so that a zero-initialised key reliably reads as "uninitialised" (TLS index 0 is itself a valid slot). */

Source from the content-addressed store, hash-verified

94 Keys are stored as (TLS index + 1) so that a zero-initialised key reliably
95 reads as "uninitialised" (TLS index 0 is itself a valid slot). */
96int pthread_key_create(pthread_key_t* key, void (*destructor)(void*)) {
97 DWORD idx;
98 (void)destructor; /* per-key destructors are not supported */
99 idx = TlsAlloc();
100 if (idx == TLS_OUT_OF_INDEXES) {
101 return EAGAIN;
102 }
103 *key = (pthread_key_t)(idx + 1);
104 return 0;
105}
106
107int pthread_key_delete(pthread_key_t key) {
108 if (key == 0) {

Callers 1

initializerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected