#include #include #include #include #include struct string_sleep { char* string; unsigned int seconds; }; void* print_sleep(void* arg) { struct string_sleep* ss = (struct string_sleep*)arg; while (true) { printf("%s", ss->string); fflush(stdout); sleep(ss->seconds); } } int main(int argc, char** argv) { pthread_t thd1, thd2; struct string_sleep zeros = {"0", 1}; struct string_sleep ones = {"1", 2}; pthread_create(&thd1, NULL, print_sleep, &zeros); pthread_create(&thd2, NULL, print_sleep, &ones ); void* result; pthread_join(thd1, &result); pthread_join(thd2, &result); }