- pthread_t pth;
- T_ASSERT_POSIX_ZERO(pthread_create(&pth, NULL, do_test, NULL), NULL);
- T_ASSERT_POSIX_ZERO(pthread_join(pth, NULL), NULL);
+ for (int i = 0; i < 100; i++) {
+ uint64_t tid1 = 0, tid2 = 0;
+ pthread_t pth;
+ T_ASSERT_POSIX_ZERO(pthread_create(&pth, NULL, do_test, &tid1), NULL);
+ T_EXPECT_POSIX_ZERO(pthread_threadid_np(pth, &tid2), NULL);
+ T_ASSERT_POSIX_ZERO(pthread_join(pth, NULL), NULL);
+ T_EXPECT_EQ(tid1, tid2, "parent and child agree");
+ }