extern "C" void thr_exit (void * value_ptr) { #if defined(__linux__) || defined(__APPLE__) char fname[] = "thr_exit"; #else char fname[] = "_thr_exit"; #endif // Instantiate the pointer to thr_exit, if it hasn't been // instantiated yet. // A pointer to the library version of thr_exit. static thr_exit_function real_thr_exit = reinterpret_cast<thr_exit_function>(dlsym (RTLD_NEXT, fname)); if (real_thr_exit == nullptr) { // Error. Must fail. cerr << "Unable to find " << fname << " : " << dlerror() << endl; abort(); } // Do necessary clean-up of the TLAB and get out. exitRoutine(); (*real_thr_exit)(value_ptr); }
static inline void * startMeUp(void * a) { getCustomHeap(); getMainHoardHeap()->findUnusedHeap(); pair<threadFunctionType, void *> * z = (pair<threadFunctionType, void *> *) a; threadFunctionType f = z->first; void * arg = z->second; void * result = NULL; result = (*f)(arg); exitRoutine(); return result; }
static inline void * startMeUp(void * a) { initializeCustomHeap(); getMainHoardHeap()->findUnusedHeap(); auto * z = (pair<threadFunctionType, void *> *) a; auto f = z->first; auto arg = z->second; auto result = (*f)(arg); delete z; exitRoutine(); return result; }
extern "C" void thr_exit (void * value_ptr) { #if defined(__linux__) || defined(__APPLE__) char fname[] = "thr_exit"; #else char fname[] = "_thr_exit"; #endif // Instantiate the pointer to thr_exit, if it hasn't been // instantiated yet. // A pointer to the library version of thr_exit. static thr_exit_function real_thr_exit = reinterpret_cast<thr_exit_function>(dlsym (RTLD_NEXT, fname)); // Do necessary clean-up of the TLAB and get out. exitRoutine(); (*real_thr_exit)(value_ptr); }
extern "C" void pthread_exit (void *value_ptr) { #if defined(__linux__) || defined(__APPLE__) char fname[] = "pthread_exit"; #else char fname[] = "_pthread_exit"; #endif // Instantiate the pointer to pthread_exit, if it hasn't been // instantiated yet. // A pointer to the library version of pthread_exit. static pthread_exit_function real_pthread_exit = reinterpret_cast<pthread_exit_function> (reinterpret_cast<intptr_t>(dlsym(RTLD_NEXT, fname))); // Do necessary clean-up of the TLAB and get out. exitRoutine(); (*real_pthread_exit)(value_ptr); // We should not get here, but doing so disables a warning. exit(0); }