Go Report Card Build Status

Introduction

lock-free / mutex-free and thread-safe lists written in Go

Supports 1.18 generics

Example

Queue

func main() {
    var queue lists.Queue[int]
    // producer
    for i:=0; i<100; i++ {
        queue.Push(i)
    }
    // consumer
    var v int
    for queue.Pop(&v) {
        fmt.Println(v)
    }
    // 0
    // 1
    // 2
    // ...
    // 98
    // 99
}

Stack

func main() {
    var stack lists.Stack[int]
    // producer
    for i:=0; i<100; i++ {
        stack.Push(i)
    }
    // consumer
    var v int
    for stack.Pop(&v) {
        fmt.Println(v)
    }
    // 99
    // 98
    // ...
    // 1
    // 0
}

GitHub

View Github