Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoneBlockQueue ¶
type NoneBlockQueue struct {
// contains filtered or unexported fields
}
func NewNoneBlockQueue ¶
func NewNoneBlockQueue(size int) *NoneBlockQueue
func (*NoneBlockQueue) Fetch ¶
func (q *NoneBlockQueue) Fetch() (interface{}, bool)
func (*NoneBlockQueue) Put ¶
func (q *NoneBlockQueue) Put(item interface{}) bool
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func NewQueue ¶
Example ¶
package main import ( "fmt" "github.com/hetianyi/gox/queue" "time" ) func main() { q := queue.NewQueue(2) go func() { for i := 0; i < 10; i++ { fmt.Println("添加:", i) q.Put(i) fmt.Println("添加结束:", i) } }() go func() { for true { fmt.Println("得到:", q.Fetch()) time.Sleep(time.Second) } }() time.Sleep(time.Second * 20) }
Output:
Click to show internal directories.
Click to hide internal directories.