MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / pthread_create

Function pthread_create

source/extern/malloc.c:448–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446#include <dlfcn.h>
447
448int
449pthread_create(pthread_t* thread,
450 const pthread_attr_t* attr,
451 void* (*start_routine)(void*),
452 void* arg) {
453#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
454 defined(__APPLE__) || defined(__HAIKU__)
455 char fname[] = "pthread_create";
456#else
457 char fname[] = "_pthread_create";
458#endif
459 void* real_pthread_create = dlsym(RTLD_NEXT, fname);
460 rpmalloc_thread_initialize();
461 thread_starter_arg* starter_arg = rpmalloc(sizeof(thread_starter_arg));
462 starter_arg->real_start = start_routine;
463 starter_arg->real_arg = arg;
464 return (*(int (*)(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*))real_pthread_create)(thread, attr, thread_starter, starter_arg);
465}
466
467#endif
468

Callers 3

pthread_create_proxyFunction · 0.85
startMethod · 0.85
ThreadWithParamMethod · 0.85

Calls 2

rpmallocFunction · 0.85

Tested by 1

ThreadWithParamMethod · 0.68