| 122 | } // namespace detail |
| 123 | |
| 124 | int thread_atexit(void (*fn)(void*), void* arg) { |
| 125 | if (NULL == fn) { |
| 126 | errno = EINVAL; |
| 127 | return -1; |
| 128 | } |
| 129 | detail::ThreadExitHelper* h = detail::get_or_new_thread_exit_helper(); |
| 130 | if (h) { |
| 131 | return h->add(fn, arg); |
| 132 | } |
| 133 | errno = ENOMEM; |
| 134 | return -1; |
| 135 | } |
| 136 | |
| 137 | int thread_atexit(void (*fn)()) { |
| 138 | if (NULL == fn) { |