Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Subject ¶
type Subject struct {
// contains filtered or unexported fields
}
The caller typically cannot assume that the condition is true when Subscribe chan returns. Instead, the caller should Wait in a loop:
eventC, cancel := c.Subscribe() for !condition() { select{ case event, closed := <- eventC: ... make use of event ... } } ... make use of condition ...
func (*Subject) PublishBroadcast ¶
PublishBroadcast wakes all listeners waiting on c.
func (*Subject) PublishSignal ¶
PublishSignal wakes one listener waiting on c, if there is any.
func (*Subject) Subscribe ¶
func (s *Subject) Subscribe() (<-chan interface{}, context.CancelFunc)
Subscribe returns a channel that's closed when awoken by PublishSignal or PublishBroadcast. never be canceled. Successive calls to Subscribe return different values. The close of the Subscribe channel may happen asynchronously, after the cancel function returns.
Click to show internal directories.
Click to hide internal directories.