Question Details

No question body available.

Tags

c multithreading return-value

Answers (1)

Accepted Answer Available
Accepted Answer
March 14, 2026 Score: 10 Rep: 125,267 Quality: Expert Completeness: 70%

The return value is what can be collected when joining the thread:

#include 
#include 

int threadfunc(void* arg) { return 123; }

int main() { thrdt thr; thrdcreate(&thr, threadfunc, NULL);

// ...

int retval; if (thrd
join(thr, &retval) == thrd_success) { printf("the thread exited by returning %d\n", retval); // 123 } }