Documentation ¶
Index ¶
- type Ring
- func (rb *Ring) Cap() uint64
- func (rb *Ring) Dispose()
- func (rb *Ring) Get() (int32, error)
- func (rb *Ring) IsDisposed() bool
- func (rb *Ring) Len() uint64
- func (rb *Ring) Offer(item int32) (bool, error)
- func (rb *Ring) Poll(timeout time.Duration) (int32, error)
- func (rb *Ring) PollDeadline(deadline time.Time) (int32, error)
- func (rb *Ring) Put(item int32) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ring ¶
type Ring struct {
// contains filtered or unexported fields
}
Ring is a thread-safe bounded queue that stores int32 messages.
func (*Ring) Dispose ¶
func (rb *Ring) Dispose()
Dispose will dispose of this queue and free any blocked threads in the Put and/or Get methods. Calling those methods on a disposed queue will return an error.
func (*Ring) Get ¶
Get will return the next item in the queue. This call will block if the queue is empty. This call will unblock when an item is added to the queue or Dispose is called on the queue. An error will be returned if the queue is disposed.
func (*Ring) IsDisposed ¶
IsDisposed will return a bool indicating if this queue has been disposed.
func (*Ring) Offer ¶
Offer adds the provided item to the queue if there is space. If the queue is full, this call will return false. An error will be returned if the queue is disposed.
func (*Ring) Poll ¶
Poll will return the next item in the queue. This call will block if the queue is empty. This call will unblock when an item is added to the queue, Dispose is called on the queue, or the timeout is reached. An error will be returned if the queue is disposed or a timeout occurs. A non-positive timeout will block indefinitely.