]> git.saurik.com Git - cycript.git/blobdiff - Trampoline.t.cpp
Move cy$JSValueInContext use from cast to valueOf.
[cycript.git] / Trampoline.t.cpp
index e52962afa37b224945219b8095fc2607407184bc..267a25353dd42f64a0ed23e647c2a1cf2960081a 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");
 
@@ -58,9 +66,12 @@ void *Routine(void *arg) {
 
     void (*CYHandleServer)(pid_t);
     dlset(baton, CYHandleServer, "CYHandleServer", handle);
+    if (CYHandleServer == NULL) {
+        baton->dlerror();
+        return NULL;
+    }
 
     CYHandleServer(baton->pid);
-
     return NULL;
 }
 
@@ -78,23 +89,17 @@ extern "C" void Start(Baton *baton) {
     self.tsd[0] = &self;
     baton->__pthread_set_self(&self);
 
-    int (*pthread_create)(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *);
-    dlset(baton, pthread_create, "pthread_create");
+    //int (*pthread_create)(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *);
+    //dlset(baton, pthread_create, "pthread_create");
 
     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");
+    //mach_port_t (*mach_thread_self)();
+    //dlset(baton, mach_thread_self, "mach_thread_self");
 
-    kern_return_t (*thread_terminate)(thread_act_t);
-    dlset(baton, thread_terminate, "thread_terminate");
+    //kern_return_t (*thread_terminate)(thread_act_t);
+    //dlset(baton, thread_terminate, "thread_terminate");
 
     baton->thread_terminate(baton->mach_thread_self());
 }