]>
Commit | Line | Data |
---|---|---|
b6961e53 JF |
1 | #define _PTHREAD_ATTR_T |
2 | #include <pthread_internals.h> | |
3 | ||
4 | #include "Baton.hpp" | |
5 | ||
6 | void *Routine(void *); | |
7 | ||
8 | extern "C" void Start(Baton *baton) { | |
9 | struct _pthread self; | |
10 | baton->_pthread_set_self(&self); | |
11 | ||
12 | pthread_t thread; | |
13 | baton->pthread_create(&thread, NULL, &Routine, baton); | |
14 | ||
15 | void *result; | |
b166b11b | 16 | baton->pthread_join(thread, &result); |
b6961e53 JF |
17 | |
18 | baton->thread_terminate(baton->mach_thread_self()); | |
19 | } | |
20 | ||
21 | void *Routine(void *arg) { | |
22 | Baton *baton(reinterpret_cast<Baton *>(arg)); | |
b166b11b JF |
23 | void *handle(baton->dlopen(baton->library, RTLD_LAZY | RTLD_LOCAL)); |
24 | void (*HandleServer)(pid_t) = reinterpret_cast<void (*)(pid_t)>(baton->dlsym(handle, "CYHandleServer")); | |
25 | HandleServer(baton->pid); | |
b6961e53 JF |
26 | return arg; |
27 | } |