thread-safe queue, with limited size