sync

package
v0.0.0-...-fd2add7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2016 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package sync provides various synchronization primitives

Package sync provides various synchronization primitives

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

type Publisher struct {
	// contains filtered or unexported fields
}

Publisher allows multiple subscriptions to a continuous stream of published events. Subscribers can cancel their subscription. The zero value is ready for use.

func (*Publisher) Publish

func (p *Publisher) Publish(v interface{})

func (*Publisher) Subscribe

func (p *Publisher) Subscribe() *Subscriber

type Subscriber

type Subscriber struct {
	// contains filtered or unexported fields
}

Subscriber

func (*Subscriber) Scrub

func (s *Subscriber) Scrub()

Scrub and Wait must be not be called concurrently.

func (*Subscriber) Wait

func (s *Subscriber) Wait() interface{}

Scrub and Wait must be not be called concurrently.

type Trigger

type Trigger struct {
	// contains filtered or unexported fields
}

Trigger provides a mechanism for reconciling competing callers, only one of which should succeed in obtaining the lock (and taking some action).

func (*Trigger) Lock

func (t *Trigger) Lock() bool

Lock attempts to lock the trigger. If the trigger is not currently locked, Lock returns instantaneously with true. Otherwise, it blocks until the trigger is unlocked by its holder and returns false, WITHOUT locking the trigger on behalf of the caller.

func (*Trigger) Unlock

func (t *Trigger) Unlock()

Unlock unlocks a locked trigger.

type WaitUntil

type WaitUntil struct {
	sync.Mutex
	// contains filtered or unexported fields
}

WaitUntil notifies subscriber of a sequence of events

func (*WaitUntil) Broadcast

func (wu *WaitUntil) Broadcast()

func (*WaitUntil) MakeWaiter

func (wu *WaitUntil) MakeWaiter() Waiter

type Waiter

type Waiter chan struct{}

Waiter receivers a continuous stream of event notifications

func (Waiter) Wait

func (w Waiter) Wait()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL