Hi,
At first - thanks for such great C compiler which already implements C11 features, which not exists in many many other C compilers.
However when i try to execute such code:
#include <stdio.h>
#include <threads.h>
#define NUM_THREADS 10
int testFunction(void * data) {
printf("%d-th thread up\n", *(int*)data);
return 0;
}
int main(void) {
thrd_t threadId[NUM_THREADS];
int i;
for (i=0; i < NUM_THREADS; ++i)
if (thrd_create(threadId+i, testFunction, &i) != thrd_success)
printf("%d-th thread create error\n",i);
return 0;
}
I get that some threads not prints it's message. I suspect that this may be thread concurrency problem on shared resource. But this should result in out-of-order prints - not in skipping printf function calls - am I right ? Is it bug in thrd_create() function ? Or it is just "a bug" in my head ? Please explain ...