Documentation
¶
Overview ¶
Package gxsync provides some synchronization primitives such as trylock & semaphore.
this file provides a kind of unbouned channel
Index ¶
Constants ¶
View Source
const (
QSize = 64
)
Variables ¶
View Source
var (
ErrBroadcastClosed = fmt.Errorf("broadcast closed!")
)
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster struct {
// contains filtered or unexported fields
}
func (Broadcaster) Close ¶
func (b Broadcaster) Close()
func (Broadcaster) Write ¶
func (b Broadcaster) Write(value interface{}) (rerr error)
Node a value to all listeners.
type Receiver ¶
type Receiver struct {
C chan Node
}
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
func NewSemaphore ¶
type TryLock ¶
type TryLock struct {
// contains filtered or unexported fields
}
func NewTryLock ¶
func NewTryLock() *TryLock
type UnboundedChan ¶
type UnboundedChan struct {
// Q *gxqueue.Queue
Q *gxdeque.Deque
// contains filtered or unexported fields
}
refer from redisgo/redis/pool.go
func NewUnboundedChan ¶
func NewUnboundedChan() *UnboundedChan
func (*UnboundedChan) Close ¶
func (q *UnboundedChan) Close()
func (*UnboundedChan) Len ¶
func (q *UnboundedChan) Len() int
func (*UnboundedChan) Pop ¶
func (q *UnboundedChan) Pop() interface{}
func (*UnboundedChan) Push ¶
func (q *UnboundedChan) Push(v interface{})
func (*UnboundedChan) SetWaitOption ¶
func (q *UnboundedChan) SetWaitOption(wait bool)
在pop时,如果没有资源,是否等待 即使用乐观锁还是悲观锁
func (*UnboundedChan) TryPop ¶
func (q *UnboundedChan) TryPop() (interface{}, bool)
Click to show internal directories.
Click to hide internal directories.