Sha256: 3499d08848708eb784d299ef61e0b8226940009ce62300466d54d9f67a0ff846
Contents?: true
Size: 988 Bytes
Versions: 2
Compression:
Stored size: 988 Bytes
Contents
#include "say.h" #ifdef SAY_WIN say_thread_variable *say_thread_variable_create() { say_thread_variable *var = malloc(sizeof(say_thread_variable)); var->key = TlsAlloc(); return var; } void say_thread_variable_free(say_thread_variable *var) { TlsFree(var->key); free(var); } void say_thread_variable_set(say_thread_variable *var, void *val) { TlsSetValue(var->key, val); } void *say_thread_variable_get(say_thread_variable *var) { return TlsGetValue(var->key); } #else say_thread_variable *say_thread_variable_create() { say_thread_variable *var = malloc(sizeof(say_thread_variable)); pthread_key_create(&(var->key), NULL); return var; } void say_thread_variable_free(say_thread_variable *var) { pthread_key_delete(var->key); free(var); } void say_thread_variable_set(say_thread_variable *var, void *val) { pthread_setspecific(var->key, val); } void *say_thread_variable_get(say_thread_variable *var) { return pthread_getspecific(var->key); } #endif
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ray-0.2.1 | ext/say_thread_variable.c |
ray-0.2.0 | ext/say_thread_variable.c |