mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Add comments
This commit is contained in:
parent
f9ab3f4b81
commit
4a37b19a8f
1 changed files with 5 additions and 0 deletions
|
@ -29,6 +29,9 @@ func (q *fifoQueue) push(frame *inputTask) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// pop returns the first item of the queue, if there is one.
|
||||||
|
// The second return value will indicate if a task was returned.
|
||||||
|
// You must check this value, even after calling wait().
|
||||||
func (q *fifoQueue) pop() (*inputTask, bool) {
|
func (q *fifoQueue) pop() (*inputTask, bool) {
|
||||||
q.mutex.Lock()
|
q.mutex.Lock()
|
||||||
defer q.mutex.Unlock()
|
defer q.mutex.Unlock()
|
||||||
|
@ -47,6 +50,8 @@ func (q *fifoQueue) pop() (*inputTask, bool) {
|
||||||
return frame, true
|
return frame, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wait returns a channel which can be used to detect when an
|
||||||
|
// item is waiting in the queue.
|
||||||
func (q *fifoQueue) wait() <-chan struct{} {
|
func (q *fifoQueue) wait() <-chan struct{} {
|
||||||
q.mutex.Lock()
|
q.mutex.Lock()
|
||||||
defer q.mutex.Unlock()
|
defer q.mutex.Unlock()
|
||||||
|
|
Loading…
Reference in a new issue