| 193 | } |
| 194 | |
| 195 | void |
| 196 | TSThreadDestroy(TSThread thread) |
| 197 | { |
| 198 | sdk_assert(sdk_sanity_check_iocore_structure(thread) == TS_SUCCESS); |
| 199 | |
| 200 | INKThreadInternal *ithread = reinterpret_cast<INKThreadInternal *>(thread); |
| 201 | |
| 202 | // The thread must be destroyed by the same thread that created |
| 203 | // it because that thread is holding the thread mutex. |
| 204 | ink_release_assert(ithread->mutex->thread_holding == ithread); |
| 205 | |
| 206 | // If this thread was created by TSThreadCreate() rather than |
| 207 | // TSThreadInit, then we must not destroy it before it's done. |
| 208 | if (ithread->func) { |
| 209 | ink_release_assert(ithread->completion.done == true); |
| 210 | } |
| 211 | |
| 212 | delete ithread; |
| 213 | } |
| 214 | |
| 215 | TSThread |
| 216 | TSThreadSelf(void) |