You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
c-exercises/uiowa-threads-my-example.c

29 lines
511 B
C

#include <stdio.h>
#include "uiowa-threads.h"
void test_thread(int n) {
for (int i=0; i<10; i++) {
printf("thread %d: %d\n", n, i);
thread_relinquish();
}
}
void test_thread2(int n) {
for (int i=0; i<10; i++) {
printf("thread %d: %d\n", n, i);
thread_relinquish();
}
}
int main()
{
thread_manager_init();
thread_startup_report();
thread_launch(4000, test_thread, 1);
thread_launch(4000, test_thread2, 2);
thread_manager_start();
/* control never reaches this point */
}