Changeset 12824b9 in mainline for uspace/lib/posix/src/pthread/keys.c
- Timestamp:
- 2025-03-11T10:24:56Z (35 hours ago)
- Parents:
- 98743e2
- git-author:
- Matěj Volf <git@…> (2025-03-11 10:22:37)
- git-committer:
- Matěj Volf <git@…> (2025-03-11 10:24:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/src/pthread/keys.c
r98743e2 r12824b9 43 43 #define DPRINTF(format, ...) ((void) 0); 44 44 45 static fibril_local bool fibril_initialized = false;46 45 static atomic_ushort next_key = 1; // skip the key 'zero' 47 46 … … 57 56 void *pthread_getspecific(pthread_key_t key) 58 57 { 59 // initialization is done in setspecific -> if not initialized, nothing was set yet60 if (!fibril_initialized) {61 DPRINTF("pthread_getspecific(%d) = NULL (uninitialized)\n", key);62 return NULL;63 }64 65 58 assert(key < PTHREAD_KEYS_MAX); 66 59 assert(key < next_key); … … 74 67 { 75 68 DPRINTF("pthread_setspecific(%d, %p)\n", key, data); 76 if (!fibril_initialized) {77 DPRINTF("initializing pthread keys\n");78 for (unsigned i = 0; i < PTHREAD_KEYS_MAX; i++) {79 key_data[i] = NULL;80 }81 fibril_initialized = true;82 }83 69 assert(key < PTHREAD_KEYS_MAX); 84 70 assert(key < next_key); … … 91 77 int pthread_key_delete(pthread_key_t key) 92 78 { 93 / / see https://github.com/HelenOS/helenos/pull/245#issuecomment-270679584879 /* see https://github.com/HelenOS/helenos/pull/245#issuecomment-2706795848 */ 94 80 not_implemented(); 95 81 return EOK; … … 105 91 } 106 92 if (destructor != NULL) { 107 static int __counter = 0; 108 if (__counter == 0) { 93 /* Inlined not_implemented() macro to add custom message */ 94 static int __not_implemented_counter = 0; 95 if (__not_implemented_counter == 0) { 109 96 fprintf(stderr, "pthread_key_create: destructors not supported\n"); 110 97 } 111 __ counter++;98 __not_implemented_counter++; 112 99 } 113 100
Note:
See TracChangeset
for help on using the changeset viewer.