#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>


volatile long int a = 0;
void * reader(void *junk) {

     static int last;
     while(1) {
	  int foo = a;
	  if (last > foo) {
	       fprintf(stderr, "Buy a new computer: %d %d\n", last, foo);
	  }
	  last = foo;
     }
     return NULL;
}

void * writer(void *junk) {
     while(1) {
	  a++;
     }
     return NULL;
}

int main (int arcgv, char *argv[]) {
     pthread_t threads[2];
     int i;
     pthread_create(&threads[0], NULL, reader, NULL);
     pthread_create(&threads[1], NULL, writer, NULL);
     pthread_join(threads[1], NULL);

     return 0;
}
