linux-sysprog · beginner · ~10 min
pthread_create → pthread_join → cast return value.
Implement int run_one_thread(void) that:
(void *)(intptr_t)42.Return -1 on any failure (pthread_create or pthread_join).
The smallest possible pthread program — spawn one thread, join it, read its return value.
#include <pthread.h>
#include <stdint.h>
int run_one_thread(void) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.