MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / pthread_setspecific

Function pthread_setspecific

include/hamlib/winpthreads.h:1203–1224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201}
1202
1203static int pthread_setspecific(pthread_key_t key, const void *value)
1204{
1205 pthread_t t = pthread_self();
1206
1207 if (key > t->keymax)
1208 {
1209 int keymax = (key + 1) * 2;
1210 void **kv = (void**)realloc(t->keyval, keymax * sizeof(void *));
1211
1212 if (!kv) return ENOMEM;
1213
1214 /* Clear new region */
1215 memset(&kv[t->keymax], 0, (keymax - t->keymax)*sizeof(void*));
1216
1217 t->keyval = kv;
1218 t->keymax = keymax;
1219 }
1220
1221 t->keyval[key] = (void *) value;
1222
1223 return 0;
1224}
1225
1226
1227static int pthread_spin_init(pthread_spinlock_t *l, int pshared)

Callers 2

handle_socketFunction · 0.85
handle_socketFunction · 0.85

Calls 1

pthread_selfFunction · 0.85

Tested by

no test coverage detected