Dining philosophers: Difference between revisions
Content added Content deleted
(→{{header|Oz}}: simplified) |
|||
Line 204: | Line 204: | ||
typedef struct philData { |
typedef struct philData { |
||
pthread_mutex_t *fork_lft, *fork_rgt; |
pthread_mutex_t *fork_lft, *fork_rgt; |
||
const char *name; |
|||
pthread_t thread; |
pthread_t thread; |
||
int fail; |
int fail; |
||
Line 249: | Line 249: | ||
void Ponder() |
void Ponder() |
||
{ |
{ |
||
char *nameList[] = { "Kant", "Guatma", "Russel", "Aristotle", "Bart" }; |
const char *nameList[] = { "Kant", "Guatma", "Russel", "Aristotle", "Bart" }; |
||
pthread_mutex_t forks[5]; |
pthread_mutex_t forks[5]; |
||
Philosopher philosophers[5]; |
Philosopher philosophers[5]; |
||
Line 285: | Line 285: | ||
} |
} |
||
int main( |
int main() |
||
{ |
{ |
||
Ponder(); |
Ponder(); |