Calling pthread_create and then pthread_detach from the main thread leaves a window where the thread can run to completion before the detach gets called. Better to call pthread_detach( pthread_self() ); from the entry point of the thread – i.e. the first line in process()