Skip to content

lock-free and thread-safe implementation of lists written in Go

License

Notifications You must be signed in to change notification settings

csorchard/go-lists

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}

About

lock-free and thread-safe implementation of lists written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%