x = new std::mutex();
y = new std::mutex();
- printf("Thread %d: creating 2 threads\n", thrd_current());
+ printf("Main thread: creating 2 threads\n");
thrd_create(&t1, (thrd_start_t)&a, NULL);
thrd_create(&t2, (thrd_start_t)&b, NULL);
thrd_join(t1);
thrd_join(t2);
- printf("Thread %d is finished\n", thrd_current());
+ printf("Main thread is finished\n");
return 0;
}
atomic_init(&x, 0);
- printf("Thread %d: creating 4 threads\n", thrd_current());
+ printf("Main thread: creating 4 threads\n");
thrd_create(&t1, (thrd_start_t)&a, NULL);
thrd_create(&t2, (thrd_start_t)&b, NULL);
thrd_create(&t3, (thrd_start_t)&b, NULL);
thrd_join(t2);
thrd_join(t3);
thrd_join(t4);
- printf("Thread %d is finished\n", thrd_current());
+ printf("Main thread is finished\n");
return 0;
}
atomic_init(&x, 0);
- printf("Thread %d: creating 3 threads\n", thrd_current());
+ printf("Main thread: creating 3 threads\n");
thrd_create(&t1, (thrd_start_t)&a, NULL);
thrd_create(&t2, (thrd_start_t)&b, NULL);
thrd_create(&t3, (thrd_start_t)&c, NULL);
thrd_join(t1);
thrd_join(t2);
thrd_join(t3);
- printf("Thread %d is finished\n", thrd_current());
+ printf("Main thread is finished\n");
return 0;
}
atomic_init(&x, -1);
atomic_init(&y, 0);
- printf("Thread %d: creating 2 threads\n", thrd_current());
+ printf("Main thread: creating 2 threads\n");
thrd_create(&t1, (thrd_start_t)&a, NULL);
thrd_create(&t2, (thrd_start_t)&b, NULL);
thrd_join(t1);
thrd_join(t2);
- printf("Thread %d is finished\n", thrd_current());
+ printf("Main thread is finished\n");
return 0;
}
std::atomic_init(&x, 0);
- printf("Thread %d: creating 2 threads\n", thrd_current());
+ printf("Main thread: creating 2 threads\n");
thrd_create(&t1, (thrd_start_t)&a, NULL);
thrd_create(&t2, (thrd_start_t)&b, NULL);
thrd_create(&t3, (thrd_start_t)&c, NULL);
thrd_join(t1);
thrd_join(t2);
thrd_join(t3);
- printf("Thread %d is finished\n", thrd_current());
+ printf("Main thread is finished\n");
return 0;
}
atomic_init(&x, 0);
atomic_init(&y, 0);
- printf("Thread %d: creating 2 threads\n", thrd_current());
+ printf("Main thread: creating 2 threads\n");
thrd_create(&t1, (thrd_start_t)&a, NULL);
thrd_create(&t2, (thrd_start_t)&b, NULL);
thrd_join(t1);
thrd_join(t2);
- printf("Thread %d is finished\n", thrd_current());
+ printf("Main thread is finished\n");
return 0;
}