rc.c 358 Bytes
Newer Older
Alexander Schoch's avatar
Alexander Schoch committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include<pthread.h>

volatile int inc;

void *
thread(void *arg __attribute__((unused))) {
  for (int i = 0; i < 65536; i++) 
	inc++;
  return NULL;
}

int
main(int argc, char **argv) {
  pthread_t t1, t2;
  pthread_create(&t1, NULL, thread, NULL);
  pthread_create(&t2, NULL, thread, NULL);
  pthread_join(t1, NULL);
  pthread_join(t2, NULL);
  return 0;
}