Differences From Artifact [14860d8d54]:
- File
src/tlskey.m
— part of check-in
[5358e9ea6a]
at
2019-08-01 20:14:35
on branch trunk
— Split threading.[hm] into multiple files
This allows the runtime to only link against the parts it needs, without
pulling in unnecessary parts like thread spawning, TLS and conditions. (user: js, size: 1021) [annotate] [blame] [check-ins using]
To Artifact [b1f544f482]:
- File src/tlskey.m — part of check-in [abaf310373] at 2019-08-01 21:31:25 on branch trunk — Add thread-local storage for AmigaOS (user: js, size: 1372) [annotate] [blame] [check-ins using]
︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | 15 16 17 18 19 20 21 22 23 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 | + + + + + + + + + + + + + + + + + + + | * file. */ #include "config.h" #import "tlskey.h" #ifdef OF_AMIGAOS # import "OFMapTable.h" static const of_map_table_functions_t functions = { NULL }; #endif bool of_tlskey_new(of_tlskey_t *key) { #if defined(OF_HAVE_PTHREADS) return (pthread_key_create(key, NULL) == 0); #elif defined(OF_WINDOWS) return ((*key = TlsAlloc()) != TLS_OUT_OF_INDEXES); #elif defined(OF_AMIGAOS) @try { *key = [[OFMapTable alloc] initWithKeyFunctions: functions objectFunctions: functions]; } @catch (id e) { return false; } return true; #endif } bool of_tlskey_free(of_tlskey_t key) { #if defined(OF_HAVE_PTHREADS) return (pthread_key_delete(key) == 0); #elif defined(OF_WINDOWS) return TlsFree(key); #elif defined(OF_AMIGAOS) [key release]; return true; #endif } |