Package org.freedesktop.gstreamer.gst
Class AtomicQueue
java.lang.Object
org.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
ConstructorsConstructorDescriptionAtomicQueue(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 @Nullable TypegetType()Get the GType of the AtomicQueue classintlength()Get the amount of items in the queue.@Nullable MemorySegmentpeek()Peek the head element of the queue without removing it from the queue.@Nullable MemorySegmentpop()Get the head element of the queue.voidpush(@Nullable MemorySegment data) Appenddatato the tail of the queue.voidref()Increase the refcount ofqueue.voidunref()Unref this AtomicQueue and free the memory when the refcount reaches 0.Methods inherited from class org.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.initialSizewill 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
nullwhen the queue is empty.
-
pop
Get the head element of the queue.- Returns:
- the head element of this AtomicQueue or
nullwhen the queue is empty.
-
push
Appenddatato the tail of the queue.- Parameters:
data- the data
-
ref
public void ref()Increase the refcount ofqueue. -
unref
public void unref()Unref this AtomicQueue and free the memory when the refcount reaches 0.
-