| 579 | } |
| 580 | |
| 581 | static void |
| 582 | leaveOnceObject (collect_once_t *c) |
| 583 | { |
| 584 | collect_once_t *h, *p = NULL; |
| 585 | if (!c) |
| 586 | return; |
| 587 | pthread_spin_lock (&once_global); |
| 588 | h = once_obj; |
| 589 | while (h != NULL && c != h) |
| 590 | h = (p = h)->next; |
| 591 | |
| 592 | if (h) |
| 593 | { |
| 594 | c->count -= 1; |
| 595 | if (c->count == 0) |
| 596 | { |
| 597 | pthread_mutex_destroy(&c->m); |
| 598 | if (!p) |
| 599 | once_obj = c->next; |
| 600 | else |
| 601 | p->next = c->next; |
| 602 | free (c); |
| 603 | } |
| 604 | } |
| 605 | else |
| 606 | fprintf(stderr, "%p not found?!?!\n", c); |
| 607 | pthread_spin_unlock (&once_global); |
| 608 | } |
| 609 | |
| 610 | static void |
| 611 | _pthread_once_cleanup (void *o) |
no test coverage detected