Created
August 13, 2025 16:29
-
-
Save apmckinlay/d31fd1dd2dee9a8aa81dcc68b0c8fb74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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