#include #include #include #include #include struct thread_info { const char * msg; }; static void * thread_function(void *_arg) { struct thread_info *info = _arg; printf("Thread 1 runs, msg was `%s'\n", info->msg); return (void *) 42; } int main() { struct thread_info info = { .msg = "Hello, Thread" }; pthread_t t; pthread_create(&t, NULL, thread_function, &info); uintptr_t status; pthread_join(t, (void **) &status); printf("Thread returned status %lu\n", status); return 0; }