#include <stdio.h>
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#define n 10
void consumer(void); // thread function prototype
char buffer[n];
int in = 0, out = 0;
int
main ()
{
char nextp;
int i;
pthread_t tid;
pthread_create(&tid, NULL,consumer, NULL);
for (i = 0; i < 500; i++) {
while ( (in+1) % n == out) ;
buffer[in] = nextp; in++; in %= n;
}
pthread_join(tid,NULL);
return 0;
}
void consumer(void)
{
char nextc;