* INKqa12653. Return TSThread or null if error */
| 132 | * INKqa12653. Return TSThread or null if error |
| 133 | */ |
| 134 | TSThread |
| 135 | TSThreadCreate(TSThreadFunc func, void *data) |
| 136 | { |
| 137 | INKThreadInternal *thread; |
| 138 | ink_thread tid = 0; |
| 139 | |
| 140 | thread = new INKThreadInternal; |
| 141 | |
| 142 | ink_assert(thread->event_types == 0); |
| 143 | ink_assert(thread->mutex->thread_holding == thread); |
| 144 | |
| 145 | thread->func = func; |
| 146 | thread->data = data; |
| 147 | |
| 148 | ink_thread_create(&tid, ink_thread_trampoline, (void *)thread, 1, 0, nullptr); |
| 149 | if (!tid) { |
| 150 | return (TSThread) nullptr; |
| 151 | } |
| 152 | |
| 153 | return reinterpret_cast<TSThread>(thread); |
| 154 | } |
| 155 | |
| 156 | // Wait for a thread to complete. When a thread calls TSThreadCreate, |
| 157 | // it becomes the owner of the thread's mutex. Since only the thread |