Hello mtk, https://www.man7.org/linux/man-pages/man3/pthread_create.3.html This has a good example I saw, what do you think about replacing these pre-processor macros containing do {} while(0) with regular functions? Something like this: void handle_error_en(int en, const char * const msg) { errno = en; perror(msg); exit(EXIT_FAILURE); } void handle_error(const char * const msg) { perror(msg); exit(EXIT_FAILURE); } Although I don't think errno is such a good idea. so I'd probably write: void handle_error_en(int en, const char * const msg) { fprintf(stderr, "%s: %s\n", msg, strerror(en)); exit(EXIT_FAILURE); } I'd also suggest adding the command line to compile $ cc -Wall -pthread -o threads threads.c Regards, Jonny