/ Miscellaneous

A thread-safe circular buffer in Go

A thread-safe circular buffer in Go

ringbuffer

A circular buffer (ring buffer) in Go, implemented io.ReaderWriter interface.

Circular_Buffer_Animation

	rb := NewRingBuffer(1024)

	// write
	rb.Write([]byte("abcd"))
	fmt.Println(rb.Length())
	fmt.Println(rb.Free())

	// read
	buf := make([]byte, 4)
	rb.Read(buf)
	fmt.Println(string(buf))

GitHub