Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentMap ¶
type ConcurrentMap struct {
// contains filtered or unexported fields
}
ConcurrentMap is a thread-safe Map implementation.
func NewConcurrentMap ¶
func NewConcurrentMap() *ConcurrentMap
NewConcurrentMap creates a new ConcurrentMap.
func (*ConcurrentMap) Delete ¶
func (m *ConcurrentMap) Delete(key interface{})
Delete deletes a key-value pair from the Map.
func (*ConcurrentMap) Get ¶
func (m *ConcurrentMap) Get(key interface{}) (interface{}, bool)
Get gets a value from the Map by key.
func (*ConcurrentMap) Put ¶
func (m *ConcurrentMap) Put(key, value interface{})
Put puts a key-value pair into the Map.
func (*ConcurrentMap) Size ¶
func (m *ConcurrentMap) Size() int
Size returns the number of key-value pairs in the Map.
type ConcurrentQueue ¶
type ConcurrentQueue struct {
// contains filtered or unexported fields
}
ConcurrentQueue is a simple thread-safe queue.
func NewConcurrentQueue ¶
func NewConcurrentQueue() *ConcurrentQueue
NewConcurrentQueue creates a new ConcurrentQueue.
func (*ConcurrentQueue) Dequeue ¶
func (q *ConcurrentQueue) Dequeue() (interface{}, bool)
Dequeue removes an element from the beginning of the queue and returns it.
func (*ConcurrentQueue) Enqueue ¶
func (q *ConcurrentQueue) Enqueue(item interface{})
Enqueue adds an element to the end of the queue.
func (*ConcurrentQueue) Size ¶
func (q *ConcurrentQueue) Size() int
Size returns the number of elements in the queue.
type ConcurrentSet ¶
type ConcurrentSet struct {
// contains filtered or unexported fields
}
ConcurrentSet is a thread-safe Set implementation.
func NewConcurrentSet ¶
func NewConcurrentSet() *ConcurrentSet
NewConcurrentSet creates a new ConcurrentSet.
func (*ConcurrentSet) Add ¶
func (s *ConcurrentSet) Add(item interface{})
Add adds an element to the Set.
func (*ConcurrentSet) Contains ¶
func (s *ConcurrentSet) Contains(item interface{}) bool
Contains checks if an element is in the Set.
func (*ConcurrentSet) Remove ¶
func (s *ConcurrentSet) Remove(item interface{})
Remove removes an element from the Set.
func (*ConcurrentSet) Size ¶
func (s *ConcurrentSet) Size() int
Size returns the number of elements in the Set.
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter is a thread-safe counter.
type Semaphore ¶
type Semaphore struct {
// contains filtered or unexported fields
}
Semaphore is a simple semaphore implementation.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool is a simple worker pool implementation.
func NewWorkerPool ¶
func NewWorkerPool(workerCount int) *WorkerPool
NewWorkerPool creates a new WorkerPool.
func (*WorkerPool) Shutdown ¶
func (p *WorkerPool) Shutdown()
Shutdown shuts down the worker pool and waits for all tasks to complete.
func (*WorkerPool) Submit ¶
func (p *WorkerPool) Submit(task func())
Submit submits a task to the worker pool.