Lines Matching refs:store
49 void* thread_store_get( thread_store_t* store ) in thread_store_get() argument
51 if (!store->has_tls) in thread_store_get()
54 return pthread_getspecific( store->tls ); in thread_store_get()
57 extern void thread_store_set( thread_store_t* store, in thread_store_set() argument
61 pthread_mutex_lock( &store->lock ); in thread_store_set()
62 if (!store->has_tls) { in thread_store_set()
63 if (pthread_key_create( &store->tls, destroy) != 0) { in thread_store_set()
64 pthread_mutex_unlock(&store->lock); in thread_store_set()
67 store->has_tls = 1; in thread_store_set()
69 pthread_mutex_unlock( &store->lock ); in thread_store_set()
71 pthread_setspecific( store->tls, value ); in thread_store_set()
75 void* thread_store_get( thread_store_t* store ) in thread_store_get() argument
77 if (!store->has_tls) in thread_store_get()
80 return (void*) TlsGetValue( store->tls ); in thread_store_get()
83 void thread_store_set( thread_store_t* store, in thread_store_set() argument
88 if (!store->lock_init) { in thread_store_set()
89 store->lock_init = -1; in thread_store_set()
90 InitializeCriticalSection( &store->lock ); in thread_store_set()
91 store->lock_init = -2; in thread_store_set()
92 } else while (store->lock_init != -2) { in thread_store_set()
96 EnterCriticalSection( &store->lock ); in thread_store_set()
97 if (!store->has_tls) { in thread_store_set()
98 store->tls = TlsAlloc(); in thread_store_set()
99 if (store->tls == TLS_OUT_OF_INDEXES) { in thread_store_set()
100 LeaveCriticalSection( &store->lock ); in thread_store_set()
103 store->has_tls = 1; in thread_store_set()
105 LeaveCriticalSection( &store->lock ); in thread_store_set()
107 TlsSetValue( store->tls, value ); in thread_store_set()