From 40b1517d56f509a5faebb5ab25988c1d2216e879 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 20 May 2011 07:11:49 +0000 Subject: [PATCH] Use pthread_detach(), not pthread_join(). --- Baton.hpp | 2 -- Mach/Inject.cpp | 2 -- Trampoline.t.cpp | 14 ++++++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Baton.hpp b/Baton.hpp index bf048ba..76c089f 100644 --- a/Baton.hpp +++ b/Baton.hpp @@ -25,9 +25,7 @@ struct Baton { void (*__pthread_set_self)(pthread_t); - int (*pthread_create)(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *); - int (*pthread_join)(pthread_t, void **); mach_port_t (*mach_thread_self)(); kern_return_t (*thread_terminate)(thread_act_t); diff --git a/Mach/Inject.cpp b/Mach/Inject.cpp index 3f91398..4c0b1bb 100644 --- a/Mach/Inject.cpp +++ b/Mach/Inject.cpp @@ -47,9 +47,7 @@ void InjectLibrary(pid_t pid) { Baton *baton(reinterpret_cast(local)); baton->__pthread_set_self = &__pthread_set_self; - baton->pthread_create = &pthread_create; - baton->pthread_join = &pthread_join; baton->mach_thread_self = &mach_thread_self; baton->thread_terminate = &thread_terminate; diff --git a/Trampoline.t.cpp b/Trampoline.t.cpp index 5bf77ce..1d7cf95 100644 --- a/Trampoline.t.cpp +++ b/Trampoline.t.cpp @@ -38,6 +38,14 @@ static _finline void dlset(Baton *baton, Type_ &function, const char *name, void void *Routine(void *arg) { Baton *baton(reinterpret_cast(arg)); + int (*pthread_detach)(pthread_t); + dlset(baton, pthread_detach, "pthread_detach"); + + pthread_t (*pthread_self)(); + dlset(baton, pthread_self, "pthread_self"); + + pthread_detach(pthread_self()); + void *(*dlopen)(const char *, int); dlset(baton, dlopen, "dlopen"); @@ -85,12 +93,6 @@ extern "C" void Start(Baton *baton) { pthread_t thread; baton->pthread_create(&thread, NULL, &Routine, baton); - //int (*pthread_join)(pthread_t, void **); - //dlset(baton, pthread_join, "pthread_join"); - - //void *result; - //baton->pthread_join(thread, &result); - //mach_port_t (*mach_thread_self)(); //dlset(baton, mach_thread_self, "mach_thread_self"); -- 2.47.2