Skip to content

Instantly share code, notes, and snippets.

@apmckinlay
Created August 13, 2025 16:29
Show Gist options
  • Save apmckinlay/d31fd1dd2dee9a8aa81dcc68b0c8fb74 to your computer and use it in GitHub Desktop.
Save apmckinlay/d31fd1dd2dee9a8aa81dcc68b0c8fb74 to your computer and use it in GitHub Desktop.
func TestPriorityQueue(t *testing.T) {
pq := NewPriorityQueue()
val := &struct{}{}
var wg sync.WaitGroup
const nthreads = 32
for range nthreads {
wg.Add(1)
go func() {
for range 100_000 {
pq.Put(1, 1, val)
}
wg.Done()
fmt.Println("done")
}()
}
wg.Add(1)
go func() {
for range 100_000 * nthreads {
pq.Get()
}
wg.Done()
}()
wg.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment