Skip to content

Commit

Permalink
添加: 自定义长度队列
Browse files Browse the repository at this point in the history
  • Loading branch information
davyxu committed Jun 28, 2017
1 parent 71704ca commit cd556a6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,18 @@ func (self *evQueue) Wait() int {
return <-self.exitSignal
}

const DefaultQueueSize = 100

func NewEventQueue() EventQueue {

return NewEventQueueByLen(DefaultQueueSize)
}

func NewEventQueueByLen(l int) EventQueue {
self := &evQueue{
queue: make(chan func(), 10),
queue: make(chan func(), l),
exitSignal: make(chan int),
}

return self

}

0 comments on commit cd556a6

Please sign in to comment.