internal

package
v1.3.78 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to a string without memory allocation.

Note it may break if the implementation of string or slice header changes in the future go versions.

func CeilToPowerOfTwo

func CeilToPowerOfTwo(n int) int

CeilToPowerOfTwo returns the least power of two integer value greater than or equal to n.

func FloorToPowerOfTwo

func FloorToPowerOfTwo(n int) int

FloorToPowerOfTwo returns the greatest power of two integer value less than or equal to n.

func IsPowerOfTwo

func IsPowerOfTwo(n int) bool

IsPowerOfTwo reports whether given integer is a power of two.

func SpinLock

func SpinLock() sync.Locker

SpinLock creates a new spin-lock.

func StringToBytes

func StringToBytes(s string) (b []byte)

StringToBytes converts string to a byte slice without memory allocation.

Note it may break if the implementation of string or slice header changes in the future go versions.

Types

type AsyncJobQueue

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

AsyncJobQueue queues pending tasks.

func NewAsyncJobQueue

func NewAsyncJobQueue() AsyncJobQueue

NewAsyncJobQueue creates a note-queue.

func (*AsyncJobQueue) ForEach

func (q *AsyncJobQueue) ForEach() (err error)

ForEach iterates this queue and executes each note with a given func.

func (*AsyncJobQueue) Push

func (q *AsyncJobQueue) Push(job Job) (jobsNum int)

Push pushes a item into queue.

type Job

type Job func() error

Job is a asynchronous function.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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