#include "philtable.h"
#include <unistd.h>
#include <stdio.h>
void * philosopher(int * a);
int main(void) {
tableinit(philosopher);
sleep(60); // Wait a while then exit
printf("WE ARE DONE\n");
return 0;
}
void * philosopher(int * who) {
/* For simplicity, all philosophers eat for the same amount */
/* of time and think for a time that is simply related */
/* to their position at the table. The parameter who identifies*/
/* the philosopher: 0, 1, 2, .. */
while (1){
sleep((*who)+1);
pickup((*who));
sleep(1);
putdown((*who));
}
}