MCPcopy Create free account
hub / github.com/apache/trafficserver / TSThreadWait

Function TSThreadWait

src/api/InkIOCoreAPI.cc:162–175  ·  view source on GitHub ↗

Wait for a thread to complete. When a thread calls TSThreadCreate, it becomes the owner of the thread's mutex. Since only the thread that locked a mutex should be allowed to unlock it (a condition that is enforced for PTHREAD_MUTEX_ERRORCHECK), if the application needs to delete the thread, it must first wait for the thread to complete.

Source from the content-addressed store, hash-verified

160// needs to delete the thread, it must first wait for the thread to
161// complete.
162void
163TSThreadWait(TSThread thread)
164{
165 sdk_assert(sdk_sanity_check_iocore_structure(thread) == TS_SUCCESS);
166 INKThreadInternal *ithread = reinterpret_cast<INKThreadInternal *>(thread);
167
168 ink_mutex_acquire(&ithread->completion.lock);
169
170 if (ithread->completion.done == false) {
171 ink_cond_wait(&ithread->completion.signal, &ithread->completion.lock);
172 }
173
174 ink_mutex_release(&ithread->completion.lock);
175}
176
177TSThread
178TSThreadInit()

Callers 3

~Blocking_actionMethod · 0.85
~ThreadPoolMethod · 0.85

Calls 4

ink_mutex_acquireFunction · 0.85
ink_cond_waitFunction · 0.85
ink_mutex_releaseFunction · 0.85

Tested by 1