Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed Jan 7, 2018
1 parent c41a40c commit d9af29a
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Queue

[![GoDoc](https://godoc.org/github.com/sheerun/queue?status.svg)](https://godoc.org/github.com/sheerun/queue)
[![Release](https://img.shields.io/github/release/sheerun/queue.svg)](https://github.com/sheerun/queue/releases/latest)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.txt)

An blocking FIFO queue based on auto-growing circular buffer, without goroutines.

## Usage

```go
q := New()

var wg sync.WaitGroup

wg.Add(2)

go func() {
for i := 0; i < 10000; i++ {
q.Append(i)
}
wg.Done()
}()

go func() {
for i := 0; i < 10000; i++ {
if q.Pop() != i {
t.Errorf("Invalid returned index: %d", i)
wg.Done()
return
}
}
wg.Done()
}()

wg.Wait()
```

## License

MIT

0 comments on commit d9af29a

Please sign in to comment.