Package org.freedesktop.gstreamer.gst
Class AtomicQueue
java.lang.Object
io.github.jwharm.javagi.base.ProxyInstance
org.freedesktop.gstreamer.gst.AtomicQueue
- All Implemented Interfaces:
Proxy
The
GstAtomicQueue
object implements a queue that can be used from multiple
threads without performing any blocking operations.-
Constructor Summary
ConstructorDescriptionAtomicQueue
(int initialSize) Create a new atomic queue instance.AtomicQueue
(MemorySegment address) Create a AtomicQueue proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionstatic Type
getType()
Get the GType of the AtomicQueue classint
length()
Get the amount of items in the queue.peek()
Peek the head element of the queue without removing it from the queue.pop()
Get the head element of the queue.void
push
(@Nullable MemorySegment data) Appenddata
to the tail of the queue.void
ref()
Increase the refcount of this AtomicQueue.void
unref()
Unref this AtomicQueue and free the memory when the refcount reaches 0.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
AtomicQueue
Create a AtomicQueue proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
AtomicQueue
public AtomicQueue(int initialSize) Create a new atomic queue instance.initialSize
will be rounded up to the nearest power of 2 and used as the initial size of the queue.- Parameters:
initialSize
- initial queue size
-
-
Method Details
-
getType
-
length
public int length()Get the amount of items in the queue.- Returns:
- the number of elements in the queue.
-
peek
Peek the head element of the queue without removing it from the queue.- Returns:
- the head element of this AtomicQueue or
null
when the queue is empty.
-
pop
Get the head element of the queue.- Returns:
- the head element of this AtomicQueue or
null
when the queue is empty.
-
push
Appenddata
to the tail of the queue.- Parameters:
data
- the data
-
ref
public void ref()Increase the refcount of this AtomicQueue. -
unref
public void unref()Unref this AtomicQueue and free the memory when the refcount reaches 0.
-