concurrency

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncCallWithTimeout

func FuncCallWithTimeout(callBackFunc func() <-chan bool, timeoutFunc func(), timeoutDuration time.Duration) error

FuncCallWithTimeout calls a given func and exists if the operation not completed in time

Types

type Channel

type Channel struct {
	CH chan interface{}
	// contains filtered or unexported fields
}

Channel struct

func NewChannel

func NewChannel(capacity int) *Channel

NewChannel returns new instance

func (*Channel) IsClosed

func (c *Channel) IsClosed() bool

IsClosed returns status

func (*Channel) SafeClose

func (c *Channel) SafeClose()

SafeClose closes only once

func (*Channel) SafeSend

func (c *Channel) SafeSend(data interface{})

SafeSend sends data safely

type Runner

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

Runner struct

func GetAsyncRunner

func GetAsyncRunner(customFunc func(), execInterval time.Duration, isOnetimeJob bool) *Runner

GetAsyncRunner func executes the given func on the specified interval

func (*Runner) Close

func (r *Runner) Close()

Close func

func (*Runner) Start

func (r *Runner) Start() error

Start triggers the execution

func (*Runner) StartAsync

func (r *Runner) StartAsync()

type SafeBool

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

SafeBool is safe to use in concurrently.

func (*SafeBool) IsSet

func (sb *SafeBool) IsSet() bool

IsSet returns state

func (*SafeBool) Reset

func (sb *SafeBool) Reset()

Reset updates the state to false

func (*SafeBool) Set

func (sb *SafeBool) Set()

Set updates the state to true

type Store

type Store struct {
	Name string
	// contains filtered or unexported fields
}

Store struct

func NewStore

func NewStore() *Store

NewStore returns brandnew store

func (*Store) Add

func (s *Store) Add(key string, value interface{})

Add a value to the store

func (*Store) Get

func (s *Store) Get(key string) interface{}

Get a value from the store

func (*Store) IsAvailable

func (s *Store) IsAvailable(key string) bool

IsAvailable returns the availability

func (*Store) Keys

func (s *Store) Keys() []string

Keys returns the available keys

func (*Store) Remove

func (s *Store) Remove(key string)

Remove a value to the store

Jump to

Keyboard shortcuts

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