sync

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cond

type Cond struct {
	L Locker
	// contains filtered or unexported fields
}

func (*Cond) Broadcast

func (c *Cond) Broadcast()

func (*Cond) Signal

func (c *Cond) Signal()

func (*Cond) Wait

func (c *Cond) Wait()

type Pool

type Pool struct {
	New func() interface{}
	// contains filtered or unexported fields
}

A Pool is a set of temporary objects that may be individually saved and retrieved.

GopherJS provides a simpler, naive implementation with no synchronization at all. This is still correct for the GopherJS runtime because:

  1. JavaScript is single-threaded, so it is impossible for two threads to be accessing the pool at the same moment in time.
  2. GopherJS goroutine implementation uses cooperative multi-tasking model, which only allows passing control to other goroutines when the function might block.

TODO(nevkontakte): Consider adding a mutex just to be safe if it doesn't create a large performance hit.

Note: there is a special handling in the gopherjs/build package that filters out all original Pool implementation in order to avoid awkward unused fields referenced by dead code.

func (*Pool) Get

func (p *Pool) Get() interface{}

func (*Pool) Put

func (p *Pool) Put(x interface{})

type WaitGroup

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

func (*WaitGroup) Add

func (wg *WaitGroup) Add(delta int)

func (*WaitGroup) Wait

func (wg *WaitGroup) Wait()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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