std.collection.concurrent Package
Function Description
The collection.concurrent package provides concurrency-safe collection types.
This package implements the following concurrency-safe collection types:
-
ArrayBlockingQueue: bounded queue of a fixed size, which is implemented in the form of arrays
-
BlockingQueue: thread-safe queue, which supports blocking element obtaining when the queue is empty and blocking element addition when the queue is full
-
ConcurrentHashMap: thread-safe hash table implementation, which supports high-concurrency read and write operations
-
NonBlockingQueue: thread-safe queue data structure (When an element is added, if the number of elements in the tail block reaches the maximum, a new block is created. In this way, the element addition is not blocked. Therefore, in a multi-thread environment, thread blocking caused by blocked operations on the queue can be prevented, thereby improving program performance.)
API List
Interface
Name | Description |
---|---|
ConcurrentMap<K, V> where K <: Equatable<K> | Guarantees thread security and operation atomicity. |
Class
Name | Description |
---|---|
ArrayBlockingQueue<E> | Implements the BlockingQueue data structure and related operation functions based on arrays. |
BlockingQueue<E> | Implements a concurrent queue with a blocking mechanism, which allows users to specify the upper limit of capacity. |
ConcurrentHashMapIterator<K, V> where K <: Hashable & Equatable<K> | Implements the iterator functions of ConcurrentHashMap. |
ConcurrentHashMap<K, V> where K <: Hashable & Equatable<K> | Implements the thread-safe ConcurrentHashMap hash table data structure and related operation functions in concurrency scenarios. |
NonBlockingQueue<E> | Provides thread-safe queues supporting safe addition and deletion of elements in a multi-thread environment. |