astisync

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CtxQueue

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

CtxQueue is a queue that can - handle a context without dropping any messages sent previously - ensure that sending a message is not blocking even if the context has been cancelled and the queue has not been started

func NewCtxQueue

func NewCtxQueue() *CtxQueue

NewCtxQueue creates a new ctx queue

func (*CtxQueue) AddStats

func (q *CtxQueue) AddStats(s *astistat.Stater)

AddStats adds queue stats

func (*CtxQueue) HandleCtx

func (q *CtxQueue) HandleCtx(ctx context.Context)

HandleCtx handles the ctx

func (*CtxQueue) Send

func (q *CtxQueue) Send(p interface{})

Send sends a message in the queue and blocks until the message has been fully processed Block indicates whether to block until the message has been fully processed

func (*CtxQueue) Start

func (q *CtxQueue) Start(fn func(p interface{}))

Start starts the queue

func (*CtxQueue) Stop

func (q *CtxQueue) Stop()

Stop stops the queue properly

type Do

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

Do is an object capable of doing stuff in FIFO order without blocking

func NewDo

func NewDo() (d *Do)

NewDo creates a new Do

func (*Do) Close

func (d *Do) Close() error

Close implements the io.Closer interface

func (*Do) Do

func (d *Do) Do(fn func())

Do execute a new func

type RWMutex

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

RWMutex represents a RWMutex capable of logging its actions to ease deadlock debugging

func NewRWMutex

func NewRWMutex(name string, log bool) *RWMutex

NewRWMutex creates a new RWMutex

func (*RWMutex) IsDeadlocked

func (m *RWMutex) IsDeadlocked(timeout time.Duration) (o bool, c string)

IsDeadlocked checks whether the mutex is deadlocked with a given timeout and returns the last caller

func (*RWMutex) Lock

func (m *RWMutex) Lock()

Lock write locks the mutex

func (*RWMutex) RLock

func (m *RWMutex) RLock()

RLock read locks the mutex

func (*RWMutex) RUnlock

func (m *RWMutex) RUnlock()

RUnlock read unlocks the mutex

func (*RWMutex) Unlock

func (m *RWMutex) Unlock()

Unlock write unlocks the mutex

Jump to

Keyboard shortcuts

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