| 101 | // NOTE(cmcfarlen): removed posix thread local key functions, use thread_local |
| 102 | |
| 103 | static inline void |
| 104 | ink_thread_create(ink_thread *tid, void *(*f)(void *), void *a, int detached, size_t stacksize, void *stack) |
| 105 | { |
| 106 | ink_thread t; |
| 107 | int ret; |
| 108 | pthread_attr_t attr; |
| 109 | |
| 110 | if (tid == nullptr) { |
| 111 | tid = &t; |
| 112 | } |
| 113 | |
| 114 | pthread_attr_init(&attr); |
| 115 | pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); |
| 116 | |
| 117 | if (stacksize) { |
| 118 | if (stack) { |
| 119 | pthread_attr_setstack(&attr, stack, stacksize); |
| 120 | } else { |
| 121 | pthread_attr_setstacksize(&attr, stacksize); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | if (detached) { |
| 126 | pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); |
| 127 | } |
| 128 | |
| 129 | ret = pthread_create(tid, &attr, f, a); |
| 130 | if (ret != 0) { |
| 131 | ink_abort("pthread_create() failed: %s (%d)", strerror(ret), ret); |
| 132 | } |
| 133 | pthread_attr_destroy(&attr); |
| 134 | } |
| 135 | |
| 136 | static inline void |
| 137 | ink_thread_cancel(ink_thread who) |