Added `poll()` which lets user check if the queue is empty or not
This commit is contained in:
parent
9c7d15dc89
commit
c241d06ea9
|
@ -91,6 +91,22 @@ public final class Queue
|
|||
queueLock.unlock();
|
||||
}
|
||||
|
||||
public bool poll()
|
||||
{
|
||||
/* Status */
|
||||
bool status;
|
||||
|
||||
/* Lock the queue */
|
||||
queueLock.lock();
|
||||
|
||||
status = !queue.empty();
|
||||
|
||||
/* Unlock the queue */
|
||||
queueLock.unlock();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to coninuously dequeue the
|
||||
* head of the queue
|
||||
|
|
Loading…
Reference in New Issue