#include #include #include struct thread { pthread_t daThread; } *mThread; static void * thread1(void * _tn) { printf("My thread is %p\n", mThread); return NULL; } struct thread * createThread(void * (*fn)(void *)) { struct thread *t = malloc(sizeof(*t)); pthread_create(&t->daThread, NULL, fn, NULL); return t; } int main() { mThread = createThread(thread1); pthread_join(mThread->daThread, NULL); return 0; }