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

Function ink_thread_create

include/tscore/ink_thread.h:103–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101// NOTE(cmcfarlen): removed posix thread local key functions, use thread_local
102
103static inline void
104ink_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
136static inline void
137ink_thread_cancel(ink_thread who)

Callers 5

setup_test_case_1Function · 0.85
startMethod · 0.85
start_threadMethod · 0.85
mainFunction · 0.85
TSThreadCreateFunction · 0.85

Calls 1

ink_abortFunction · 0.50

Tested by 1

mainFunction · 0.68