|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Fork
Every fork holds information about its owner -- the philosopher who currently uses it. A fork can be given to a philosopher and released via its synchronized methods only.
Field Summary | |
private Philosopher |
owner
|
Constructor Summary | |
Fork()
Creates a new fork with no owner. |
Method Summary | |
void |
acquireFork(Philosopher philosopher)
Gives the fork to the philosopher requiring it. |
Philosopher |
getOwner()
Returns the fork's owner. |
void |
releaseFork(Philosopher philosopher)
Releases the fork and wakes up a blocked thread waiting for the fork, if there is any. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private Philosopher owner
Constructor Detail |
public Fork()
Method Detail |
public Philosopher getOwner()
public void acquireFork(Philosopher philosopher)
public void releaseFork(Philosopher philosopher)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |