21 lines
603 B
Java
21 lines
603 B
Java
package semaphore;
|
|
|
|
public interface Queue<T> {
|
|
|
|
/**
|
|
* Puts an element into the queue, waiting if necessary for
|
|
* space to become available
|
|
* @param the element to be put into the queue
|
|
* @throws InterruptedException if interrupted while waiting
|
|
*/
|
|
void put (T element) throws InterruptedException;
|
|
|
|
/**
|
|
* Retrieves and removes the first element in this queue (in FIFO order),
|
|
* waiting if necessary until a element enters the queue
|
|
* @return the first element on this queue
|
|
* @throws InterruptedException if interrupted while waiting
|
|
*/
|
|
T take() throws InterruptedException;
|
|
}
|