Lines Matching defs:store
20 void* thread_store_get( thread_store_t* store )
22 const pthread_key_t k = store->tls;
24 if (!store->has_tls)
27 return pthread_getspecific( store->tls );
30 extern void thread_store_set( thread_store_t* store,
34 pthread_mutex_lock( &store->lock );
35 if (!store->has_tls) {
36 if (pthread_key_create( &store->tls, destroy) != 0) {
37 pthread_mutex_unlock(&store->lock);
40 store->has_tls = 1;
42 pthread_mutex_unlock( &store->lock );
44 pthread_setspecific( store->tls, value );
50 void* thread_store_get( thread_store_t* store )
52 if (!store->has_tls)
55 return (void*) TlsGetValue( store->tls );
58 void thread_store_set( thread_store_t* store,
63 if (!store->lock_init) {
64 store->lock_init = -1;
65 InitializeCriticalSection( &store->lock );
66 store->lock_init = -2;
67 } else while (store->lock_init != -2) {
71 EnterCriticalSection( &store->lock );
72 if (!store->has_tls) {
73 store->tls = TlsAlloc();
74 if (store->tls == TLS_OUT_OF_INDEXES) {
75 LeaveCriticalSection( &store->lock );
78 store->has_tls = 1;
80 LeaveCriticalSection( &store->lock );
82 TlsSetValue( store->tls, value );