MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / pthread_create_hook

Function pthread_create_hook

src/hooks.cpp:72–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72static int pthread_create_hook(pthread_t* thread, const pthread_attr_t* attr, ThreadFunc start_routine, void* arg) {
73 ThreadEntry* entry = (ThreadEntry*) malloc(sizeof(ThreadEntry));
74 entry->start_routine = start_routine;
75 entry->arg = arg;
76
77 int result = _orig_pthread_create(thread, attr, thread_start_wrapper, entry);
78 if (result != 0) {
79 free(entry);
80 }
81 return result;
82}
83
84static void pthread_exit_hook(void* retval) {
85 Log::debug("thread_exit: 0x%lx", (unsigned long)(uintptr_t)pthread_self());

Callers 1

pthread_createFunction · 0.85

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected