]> git.saurik.com Git - cycript.git/commitdiff
Use pthread_detach(), not pthread_join(). v0.9.438
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 20 May 2011 07:11:49 +0000 (07:11 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 20 May 2011 07:11:49 +0000 (07:11 +0000)
Baton.hpp
Mach/Inject.cpp
Trampoline.t.cpp

index bf048bad2215783bf815093d864d43c20cc77197..76c089fd2d52aa9931ceb9b7d92326b995b8c127 100644 (file)
--- 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);
index 3f91398a899ee4ac4ae2de89f135a01986a70c26..4c0b1bbf0f2094215bb3072aec14c2fe74c43ad2 100644 (file)
@@ -47,9 +47,7 @@ void InjectLibrary(pid_t pid) {
     Baton *baton(reinterpret_cast<Baton *>(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;
index 5bf77cea2339d6c969452da851fcd40ffd9daa31..1d7cf95d21338857c28e30e7f11479803e67cdf2 100644 (file)
@@ -38,6 +38,14 @@ static _finline void dlset(Baton *baton, Type_ &function, const char *name, void
 void *Routine(void *arg) {
     Baton *baton(reinterpret_cast<Baton *>(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");