Import std.concurrent.concurrent_queue
ConcurrentQueue
std.concurrent.concurrent_queue
class
Public Shared Class ConcurrentQueue<T: Sendable> Implements Defaultable
A first in, first out queue that threads share, which any of them adds to and takes from.
Examples
Const queue = ConcurrentQueue<Int>()
Parallel For i = 1 To 10
queue.Enqueue(i)
End For
Expect(queue.Count == 10)
Local sum = 0
For value In queue.ToArray()
sum += value
End For
Expect(sum == 55)std/concurrent/concurrent_queue.fb, line 43
-
A new, empty ConcurrentQueue.
-
How many values there are, which other threads may change at any time.
-
Puts
valueat the back. Panics when the ConcurrentQueue has as many values as an Int counts. -
The same as Enqueue.
-
Enqueues each of the
values, in order, all read first. Other threads' may come between them. -
Takes the front value off and gives it, or Null when the ConcurrentQueue is empty.
-
The front value, which stays, or Null when the ConcurrentQueue is empty.
-
The values from the front, the order TryDequeue gives them, in a new array.
-
Removes every value. They go once it holds no lock, so a Destroy that their going runs can use the ConcurrentQueue.
-
A new, empty ConcurrentQueue.
Report an issue with this page or with FutureBlitz on GitHub.