+T_DECL(pthread_join_stress, "pthread_join in a loop")
+{
+ for (int i = 0; i < 1000; i++) {
+ pthread_t th[16];
+ for (int j = 0; j < i%16; j++){
+ T_QUIET; T_ASSERT_POSIX_SUCCESS(pthread_create(&th[j], NULL, thread_stub, NULL), NULL);
+ }
+ for (int j = i%16; j >= 0; j--){
+ T_QUIET; T_ASSERT_POSIX_SUCCESS(pthread_join(th[j], NULL), NULL);
+ }
+ }
+ T_PASS("Success!");
+}