xnsyncutil

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 5 Imported by: 111

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicBool

type AtomicBool AtomicInt

func (*AtomicBool) Load

func (ab *AtomicBool) Load() bool

Load bool value atomically

func (*AtomicBool) Store

func (ab *AtomicBool) Store(v bool)

Store bool value atomically

type AtomicInt

type AtomicInt int64

func (*AtomicInt) Add

func (ai *AtomicInt) Add(delta int)

Add int value atomically

func (*AtomicInt) Load

func (ai *AtomicInt) Load() int

Load int value atomically

func (*AtomicInt) Store

func (ai *AtomicInt) Store(v int)

Store int value atomically

type AtomicInt32 added in v0.0.4

type AtomicInt32 int32

func (*AtomicInt32) Add added in v0.0.4

func (ai *AtomicInt32) Add(delta int32)

Add int value atomically

func (*AtomicInt32) Load added in v0.0.4

func (ai *AtomicInt32) Load() int32

Load int value atomically

func (*AtomicInt32) Store added in v0.0.4

func (ai *AtomicInt32) Store(v int32)

Store int value atomically

type AtomicInt64 added in v0.0.3

type AtomicInt64 int64

func (*AtomicInt64) Add added in v0.0.3

func (ai *AtomicInt64) Add(delta int64)

Add int value atomically

func (*AtomicInt64) Load added in v0.0.3

func (ai *AtomicInt64) Load() int64

Load int value atomically

func (*AtomicInt64) Store added in v0.0.3

func (ai *AtomicInt64) Store(v int64)

Store int value atomically

type AtomicPointer added in v0.0.5

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

func (*AtomicPointer) Load added in v0.0.5

func (ap *AtomicPointer) Load() unsafe.Pointer

Load ptr value atomically

func (*AtomicPointer) Store added in v0.0.5

func (ap *AtomicPointer) Store(pointer unsafe.Pointer)

Store ptr value atomically

type NewlessPool

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

func NewNewlessPool

func NewNewlessPool() *NewlessPool

func (*NewlessPool) Get

func (pool *NewlessPool) Get() (v interface{})

func (*NewlessPool) Put

func (pool *NewlessPool) Put(v interface{})

func (*NewlessPool) TryGet

func (pool *NewlessPool) TryGet() (v interface{})

type OneTimeCond

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

Synchronous condition which can be signalled only once

func NewOneTimeCond

func NewOneTimeCond() *OneTimeCond

Create a new OneTimeCond

func (*OneTimeCond) IsSignalled

func (cond *OneTimeCond) IsSignalled() (signalled bool)

Return if the condition is already signalled

func (*OneTimeCond) Signal

func (cond *OneTimeCond) Signal()

Signal the condition

All goroutines waiting for the condition will be notified to continue

func (*OneTimeCond) Wait

func (cond *OneTimeCond) Wait()

Wait for condition to be signalled.

If the condition was signalled before Wait, Wait returns immediately without blocking.

type SpinLock added in v0.0.2

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

func (*SpinLock) Lock added in v0.0.2

func (sl *SpinLock) Lock()

func (*SpinLock) Unlock added in v0.0.2

func (sl *SpinLock) Unlock()

type SyncQueue

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

Synchronous FIFO queue

func NewSyncQueue

func NewSyncQueue() *SyncQueue

Create a new SyncQueue

func (*SyncQueue) Close

func (q *SyncQueue) Close()

Close SyncQueue

After close, Pop will return nil without block, and TryPop will return v=nil, ok=True

func (*SyncQueue) Len

func (q *SyncQueue) Len() (l int)

Get the length of SyncQueue

func (*SyncQueue) Pop

func (q *SyncQueue) Pop() (v interface{})

Pop an item from SyncQueue, will block if SyncQueue is empty

func (*SyncQueue) Push

func (q *SyncQueue) Push(v interface{})

Push an item to SyncQueue. Always returns immediately without blocking

func (*SyncQueue) TryPop

func (q *SyncQueue) TryPop() (v interface{}, ok bool)

Try to pop an item from SyncQueue, will return immediately with bool=false if SyncQueue is empty

Jump to

Keyboard shortcuts

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