|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.kernel.threads.List
nachos.kernel.threads.SynchList
public class SynchList
This class defines a "synchronized list" -- a list for which these constraints hold: 1. Threads trying to remove an item from a list will wait until the list has an element on it. 2. One thread at a time can access list data structures
Nested Class Summary |
---|
Nested classes/interfaces inherited from class nachos.kernel.threads.List |
---|
List.ListElement |
Field Summary | |
---|---|
private Condition |
listEmpty
Used in remove to wait if the list is empty. |
private Lock |
lock
Lock to enforce mutual exclusive access to the list. |
Constructor Summary | |
---|---|
SynchList()
Allocate and initialize the data structures needed for a synchronized list, empty to start with. |
Method Summary | |
---|---|
void |
append(java.lang.Object item)
Append an "item" to the end of the list. |
void |
prepend(java.lang.Object item)
Put an "item" on the front of the list. |
java.lang.Object |
remove()
Remove an "item" from the beginning of the list. |
void |
sortedInsert(java.lang.Object item,
long sortKey)
Insert an "item" into a list, so that the list elements are sorted in increasing order by "sortKey". |
Methods inherited from class nachos.kernel.threads.List |
---|
isEmpty, List |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Lock lock
private Condition listEmpty
Constructor Detail |
---|
public SynchList()
Method Detail |
---|
public void append(java.lang.Object item)
append
in class List
item
- The thing to put on the list, it can be any object.public void prepend(java.lang.Object item)
prepend
in class List
item
- The thing to put on the list, it can be any object.public java.lang.Object remove()
remove
in class List
public void sortedInsert(java.lang.Object item, long sortKey)
sortedInsert
in class List
item
- The thing to put on the list, it can be any object.sortKey
- The priority of the item.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |