2024-08-25 04:08:24 +00:00
|
|
|
#include <QSemaphore>
|
|
|
|
#include <QSemaphoreReleaser>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qsemaphore.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qsemaphore.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphore* QSemaphore_new() {
|
|
|
|
return new QSemaphore();
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphore* QSemaphore_new2(int n) {
|
|
|
|
return new QSemaphore(static_cast<int>(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSemaphore_Acquire(QSemaphore* self) {
|
|
|
|
self->acquire();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QSemaphore_TryAcquire(QSemaphore* self) {
|
|
|
|
return self->tryAcquire();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QSemaphore_TryAcquire2(QSemaphore* self, int n, int timeout) {
|
|
|
|
return self->tryAcquire(static_cast<int>(n), static_cast<int>(timeout));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSemaphore_Release(QSemaphore* self) {
|
|
|
|
self->release();
|
|
|
|
}
|
|
|
|
|
|
|
|
int QSemaphore_Available(QSemaphore* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QSemaphore*>(self)->available();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QSemaphore_Acquire1(QSemaphore* self, int n) {
|
|
|
|
self->acquire(static_cast<int>(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QSemaphore_TryAcquire1(QSemaphore* self, int n) {
|
|
|
|
return self->tryAcquire(static_cast<int>(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSemaphore_Release1(QSemaphore* self, int n) {
|
|
|
|
self->release(static_cast<int>(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSemaphore_Delete(QSemaphore* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphoreReleaser* QSemaphoreReleaser_new() {
|
|
|
|
return new QSemaphoreReleaser();
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphoreReleaser* QSemaphoreReleaser_new2(QSemaphore* sem) {
|
|
|
|
return new QSemaphoreReleaser(*sem);
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphoreReleaser* QSemaphoreReleaser_new3(QSemaphore* sem) {
|
|
|
|
return new QSemaphoreReleaser(sem);
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphoreReleaser* QSemaphoreReleaser_new4(QSemaphore* sem, int n) {
|
|
|
|
return new QSemaphoreReleaser(*sem, static_cast<int>(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphoreReleaser* QSemaphoreReleaser_new5(QSemaphore* sem, int n) {
|
|
|
|
return new QSemaphoreReleaser(sem, static_cast<int>(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSemaphoreReleaser_Swap(QSemaphoreReleaser* self, QSemaphoreReleaser* other) {
|
|
|
|
self->swap(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphore* QSemaphoreReleaser_Semaphore(QSemaphoreReleaser* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QSemaphoreReleaser*>(self)->semaphore();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QSemaphore* QSemaphoreReleaser_Cancel(QSemaphoreReleaser* self) {
|
|
|
|
return self->cancel();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QSemaphoreReleaser_Delete(QSemaphoreReleaser* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|