Differences From Artifact [d958bbae58]:
- File src/tlskey.h — part of check-in [374e1a1bfa] at 2021-01-02 22:04:26 on branch trunk — Update copyright (user: js, size: 2297) [annotate] [blame] [check-ins using] [more...]
To Artifact [befb515045]:
- File
src/OFTLSKey.h
— part of check-in
[2fcf5a3052]
at
2021-04-29 23:24:22
on branch trunk
— Clean up struct and enum typedefs
With TYPEDEF_HIDES_STRUCT set, Doxygen properly handles anonymous
structs and enums that are typedef'd. (user: js, size: 2235) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
24 25 26 27 28 29 30 | # error No thread-local storage available! #endif #import "macros.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> | | | | | | | | | | | | | | | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | # error No thread-local storage available! #endif #import "macros.h" #if defined(OF_HAVE_PTHREADS) # include <pthread.h> typedef pthread_key_t OFTLSKey; #elif defined(OF_WINDOWS) # include <windows.h> typedef DWORD OFTLSKey; #elif defined(OF_MORPHOS) # include <proto/exec.h> typedef ULONG OFTLSKey; #elif defined(OF_AMIGAOS) typedef struct _OFTLSKey { struct objc_hashtable *table; struct _OFTLSKey *next, *previous; } *OFTLSKey; #endif #ifdef __cplusplus extern "C" { #endif extern int OFTLSKeyNew(OFTLSKey *key); extern int OFTLSKeyFree(OFTLSKey key); #ifdef __cplusplus } #endif /* TLS keys are inlined for performance. */ #if defined(OF_HAVE_PTHREADS) static OF_INLINE void * OFTLSKeyGet(OFTLSKey key) { return pthread_getspecific(key); } static OF_INLINE int OFTLSKeySet(OFTLSKey key, void *ptr) { return pthread_setspecific(key, ptr); } #elif defined(OF_WINDOWS) static OF_INLINE void * OFTLSKeyGet(OFTLSKey key) { return TlsGetValue(key); } static OF_INLINE int OFTLSKeySet(OFTLSKey key, void *ptr) { return (TlsSetValue(key, ptr) ? 0 : EINVAL); } #elif defined(OF_MORPHOS) static OF_INLINE void * OFTLSKeyGet(OFTLSKey key) { return (void *)TLSGetValue(key); } static OF_INLINE int OFTLSKeySet(OFTLSKey key, void *ptr) { return (TLSSetValue(key, (APTR)ptr) ? 0 : EINVAL); } #elif defined(OF_AMIGAOS) /* Those are too big too inline. */ # ifdef __cplusplus extern "C" { # endif extern void *OFTLSKeyGet(OFTLSKey key); extern int OFTLSKeySet(OFTLSKey key, void *ptr); # ifdef __cplusplus } # endif #endif |