| 372 | |
| 373 | |
| 374 | static void _pthread_cleanup_dest(pthread_t t) |
| 375 | { |
| 376 | unsigned i, j; |
| 377 | |
| 378 | for (j = 0; j < PTHREAD_DESTRUCTOR_ITERATIONS; j++) |
| 379 | { |
| 380 | int flag = 0; |
| 381 | |
| 382 | for (i = 0; i < t->keymax; i++) |
| 383 | { |
| 384 | void *val = t->keyval[i]; |
| 385 | |
| 386 | if (val) |
| 387 | { |
| 388 | pthread_rwlock_rdlock(&_pthread_key_lock); |
| 389 | if ((uintptr_t) _pthread_key_dest[i] > 1) |
| 390 | { |
| 391 | /* Call destructor */ |
| 392 | t->keyval[i] = NULL; |
| 393 | _pthread_key_dest[i](val); |
| 394 | flag = 1; |
| 395 | } |
| 396 | pthread_rwlock_unlock(&_pthread_key_lock); |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | /* Nothing to do? */ |
| 401 | if (!flag) return; |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | static pthread_t pthread_self(void) |
| 406 | { |
no test coverage detected