commit
aead15e333
@ -178,12 +178,12 @@ else if ( ret == 0 )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If we detect the event, zero it out so we can reuse the structure
|
// If we detect the event, zero it out so we can reuse the structure
|
||||||
if ( pfd[0].revents & POLLIN )
|
if ( fds[0].revents & POLLIN )
|
||||||
pfd[0].revents = 0;
|
fds[0].revents = 0;
|
||||||
// input event on sock1
|
// input event on sock1
|
||||||
|
|
||||||
if ( pfd[1].revents & POLLOUT )
|
if ( fds[1].revents & POLLOUT )
|
||||||
pfd[1].revents = 0;
|
fds[1].revents = 0;
|
||||||
// output event on sock2
|
// output event on sock2
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -613,7 +613,7 @@ void philosopher(int i) {
|
|||||||
think();
|
think();
|
||||||
take_two(i);
|
take_two(i);
|
||||||
eat();
|
eat();
|
||||||
put_tow(i);
|
put_two(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ void take_two(int i) {
|
|||||||
down(&s[i]);
|
down(&s[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void put_tow(i) {
|
void put_two(i) {
|
||||||
down(&mutex);
|
down(&mutex);
|
||||||
state[i] = THINKING;
|
state[i] = THINKING;
|
||||||
test(LEFT);
|
test(LEFT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user