项目作者: Mottl

项目描述 :
Go package circularqueue implements a thread-safe circular queue
高级语言: Go
项目地址: git://github.com/Mottl/circularqueue.git
创建时间: 2019-05-10T06:48:55Z
项目社区:https://github.com/Mottl/circularqueue

开源协议:MIT License

下载


Thread-safe circular queue for Go

GoDoc

Installation

  1. go get github.com/Mottl/circularqueue

Example

  1. package main
  2. import (
  3. "fmt"
  4. "github.com/Mottl/circularqueue"
  5. )
  6. func main() {
  7. queue := circularqueue.NewQueue(64)
  8. queue.Push(100)
  9. queue.Push(101)
  10. queue.Push(102)
  11. queue.Push(103)
  12. queue.PopAt(1) // 101, nil
  13. queue.Pop() // 103, nil
  14. fmt.Println(queue) // Queue (len=2, cap=64) [ 100, 102 ]
  15. }

License

Use of this package is governed by MIT license
that can be found in the LICENSE file.