mirror of
https://github.com/blindlobstar/go-interview-problems
synced 2025-04-19 16:25:15 +00:00
Concurrent Queue
Implement a thread-safe queue with the following properties:
- It has a fixed maximum size set at initialization.
Push(val int) error
adds an item to the queue. If the queue is full, it should returnErrQueueFull
.Pop() int
removes and returns first item from the queue. If the queue is empty, return -1.- The queue must be safe to use from multiple goroutines simultaneously.
Tags
Concurrency