io.qt.core.QSemaphore Maven / Gradle / Ivy
package io.qt.core;
import io.qt.*;
/**
* General counting semaphore
* Java wrapper for Qt class QSemaphore
*/
public class QSemaphore extends QtObject
{
static {
QtJambi_LibraryUtilities.initialize();
}
/**
* See QSemaphore:: QSemaphore(int)
* @param n
*/
public QSemaphore(int n){
super((QPrivateConstructor)null);
initialize_native(this, n);
}
private native static void initialize_native(QSemaphore instance, int n);
/**
*
* @param n
*/
@QtUninvokable
public final void acquire(int n){
acquire_native_int(QtJambi_LibraryUtilities.internal.nativeId(this), n);
}
@QtUninvokable
private native void acquire_native_int(long __this__nativeId, int n);
/**
* See QSemaphore:: available()const
* @return
*/
@QtUninvokable
public final int available(){
return available_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native int available_native_constfct(long __this__nativeId);
/**
*
* @param n
*/
@QtUninvokable
public final void release(int n){
release_native_int(QtJambi_LibraryUtilities.internal.nativeId(this), n);
}
@QtUninvokable
private native void release_native_int(long __this__nativeId, int n);
/**
* See QSemaphore:: tryAcquire(int)
* @param n
* @return
*/
@QtUninvokable
public final boolean tryAcquire(int n){
return tryAcquire_native_int(QtJambi_LibraryUtilities.internal.nativeId(this), n);
}
@QtUninvokable
private native boolean tryAcquire_native_int(long __this__nativeId, int n);
/**
* See QSemaphore:: tryAcquire(int, QDeadlineTimer)
* @since This function was introduced in Qt 6.6.
* @param n
* @param timeout
* @return
*/
@QtUninvokable
public final boolean tryAcquire(int n, io.qt.core.@NonNull QDeadlineTimer timeout){
return tryAcquire_native_int_QDeadlineTimer(QtJambi_LibraryUtilities.internal.nativeId(this), n, QtJambi_LibraryUtilities.internal.checkedNativeId(timeout));
}
@QtUninvokable
private native boolean tryAcquire_native_int_QDeadlineTimer(long __this__nativeId, int n, long timeout);
/**
* See QSemaphore:: tryAcquire(int, int)
* @param n
* @param timeout
* @return
*/
@QtUninvokable
public final boolean tryAcquire(int n, int timeout){
return tryAcquire_native_int_int(QtJambi_LibraryUtilities.internal.nativeId(this), n, timeout);
}
@QtUninvokable
private native boolean tryAcquire_native_int_int(long __this__nativeId, int n, int timeout);
/**
*
* @since This function was introduced in Qt 6.3.
* @return
*/
@QtUninvokable
public final boolean try_acquire(){
return try_acquire_native(QtJambi_LibraryUtilities.internal.nativeId(this));
}
@QtUninvokable
private native boolean try_acquire_native(long __this__nativeId);
/**
* Constructor for internal use only.
* @param p expected to be null
.
* @hidden
*/
@NativeAccess
protected QSemaphore(QPrivateConstructor p) { super(p); }
/**
* Overloaded constructor for {@link #QSemaphore(int)}
* with n = 0
.
*/
public QSemaphore() {
this((int)0);
}
/**
* Overloaded function for {@link #acquire(int)}
* with n = 1
.
*/
@QtUninvokable
public final void acquire() {
acquire((int)1);
}
/**
* Overloaded function for {@link #release(int)}
* with n = 1
.
*/
@QtUninvokable
public final void release() {
release((int)1);
}
/**
* Overloaded function for {@link #tryAcquire(int)}
* with n = 1
.
*/
@QtUninvokable
public final boolean tryAcquire() {
return tryAcquire((int)1);
}
/**
* Overloaded function for {@link #tryAcquire(int, io.qt.core.QDeadlineTimer)}.
*/
@QtUninvokable
public final boolean tryAcquire(int n, io.qt.core.QDeadlineTimer.@NonNull ForeverConstant timeout) {
return tryAcquire(n, new io.qt.core.QDeadlineTimer(timeout));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy