2024-10-20 05:21:03 +00:00
|
|
|
package qt6
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qreadwritelock.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QReadWriteLock__RecursionMode int
|
|
|
|
|
|
|
|
const (
|
|
|
|
QReadWriteLock__NonRecursive QReadWriteLock__RecursionMode = 0
|
|
|
|
QReadWriteLock__Recursive QReadWriteLock__RecursionMode = 1
|
|
|
|
)
|
|
|
|
|
|
|
|
type QReadWriteLock struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QReadWriteLock
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) cPointer() *C.QReadWriteLock {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQReadWriteLock constructs the type using only CGO pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func newQReadWriteLock(h *C.QReadWriteLock) *QReadWriteLock {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return &QReadWriteLock{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQReadWriteLock constructs the type using only unsafe pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func UnsafeNewQReadWriteLock(h unsafe.Pointer) *QReadWriteLock {
|
2024-11-19 06:29:06 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return &QReadWriteLock{h: (*C.QReadWriteLock)(h)}
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQReadWriteLock constructs a new QReadWriteLock object.
|
|
|
|
func NewQReadWriteLock() *QReadWriteLock {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QReadWriteLock *C.QReadWriteLock = nil
|
|
|
|
|
|
|
|
C.QReadWriteLock_new(&outptr_QReadWriteLock)
|
|
|
|
ret := newQReadWriteLock(outptr_QReadWriteLock)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQReadWriteLock2 constructs a new QReadWriteLock object.
|
|
|
|
func NewQReadWriteLock2(recursionMode QReadWriteLock__RecursionMode) *QReadWriteLock {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QReadWriteLock *C.QReadWriteLock = nil
|
|
|
|
|
|
|
|
C.QReadWriteLock_new2((C.int)(recursionMode), &outptr_QReadWriteLock)
|
|
|
|
ret := newQReadWriteLock(outptr_QReadWriteLock)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) LockForRead() {
|
|
|
|
C.QReadWriteLock_LockForRead(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) TryLockForRead() bool {
|
|
|
|
return (bool)(C.QReadWriteLock_TryLockForRead(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) TryLockForReadWithTimeout(timeout int) bool {
|
|
|
|
return (bool)(C.QReadWriteLock_TryLockForReadWithTimeout(this.h, (C.int)(timeout)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) LockForWrite() {
|
|
|
|
C.QReadWriteLock_LockForWrite(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) TryLockForWrite() bool {
|
|
|
|
return (bool)(C.QReadWriteLock_TryLockForWrite(this.h))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) TryLockForWriteWithTimeout(timeout int) bool {
|
|
|
|
return (bool)(C.QReadWriteLock_TryLockForWriteWithTimeout(this.h, (C.int)(timeout)))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadWriteLock) Unlock() {
|
|
|
|
C.QReadWriteLock_Unlock(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QReadWriteLock) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QReadWriteLock_Delete(this.h, C.bool(this.isSubclass))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QReadWriteLock) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QReadWriteLock) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type QReadLocker struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QReadLocker
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadLocker) cPointer() *C.QReadLocker {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadLocker) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQReadLocker constructs the type using only CGO pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func newQReadLocker(h *C.QReadLocker) *QReadLocker {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return &QReadLocker{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQReadLocker constructs the type using only unsafe pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func UnsafeNewQReadLocker(h unsafe.Pointer) *QReadLocker {
|
2024-11-19 06:29:06 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return &QReadLocker{h: (*C.QReadLocker)(h)}
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQReadLocker constructs a new QReadLocker object.
|
|
|
|
func NewQReadLocker(readWriteLock *QReadWriteLock) *QReadLocker {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QReadLocker *C.QReadLocker = nil
|
|
|
|
|
|
|
|
C.QReadLocker_new(readWriteLock.cPointer(), &outptr_QReadLocker)
|
|
|
|
ret := newQReadLocker(outptr_QReadLocker)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadLocker) Unlock() {
|
|
|
|
C.QReadLocker_Unlock(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadLocker) Relock() {
|
|
|
|
C.QReadLocker_Relock(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QReadLocker) ReadWriteLock() *QReadWriteLock {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQReadWriteLock(C.QReadLocker_ReadWriteLock(this.h))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QReadLocker) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QReadLocker_Delete(this.h, C.bool(this.isSubclass))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QReadLocker) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QReadLocker) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
type QWriteLocker struct {
|
2024-11-19 06:29:06 +00:00
|
|
|
h *C.QWriteLocker
|
|
|
|
isSubclass bool
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QWriteLocker) cPointer() *C.QWriteLocker {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QWriteLocker) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// newQWriteLocker constructs the type using only CGO pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func newQWriteLocker(h *C.QWriteLocker) *QWriteLocker {
|
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return &QWriteLocker{h: h}
|
|
|
|
}
|
|
|
|
|
2024-11-19 06:29:06 +00:00
|
|
|
// UnsafeNewQWriteLocker constructs the type using only unsafe pointers.
|
2024-10-20 05:21:03 +00:00
|
|
|
func UnsafeNewQWriteLocker(h unsafe.Pointer) *QWriteLocker {
|
2024-11-19 06:29:06 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
return &QWriteLocker{h: (*C.QWriteLocker)(h)}
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewQWriteLocker constructs a new QWriteLocker object.
|
|
|
|
func NewQWriteLocker(readWriteLock *QReadWriteLock) *QWriteLocker {
|
2024-11-19 06:29:06 +00:00
|
|
|
var outptr_QWriteLocker *C.QWriteLocker = nil
|
|
|
|
|
|
|
|
C.QWriteLocker_new(readWriteLock.cPointer(), &outptr_QWriteLocker)
|
|
|
|
ret := newQWriteLocker(outptr_QWriteLocker)
|
|
|
|
ret.isSubclass = true
|
|
|
|
return ret
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QWriteLocker) Unlock() {
|
|
|
|
C.QWriteLocker_Unlock(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QWriteLocker) Relock() {
|
|
|
|
C.QWriteLocker_Relock(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QWriteLocker) ReadWriteLock() *QReadWriteLock {
|
2024-12-07 02:02:06 +00:00
|
|
|
return newQReadWriteLock(C.QWriteLocker_ReadWriteLock(this.h))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Delete this object from C++ memory.
|
|
|
|
func (this *QWriteLocker) Delete() {
|
2024-11-19 06:29:06 +00:00
|
|
|
C.QWriteLocker_Delete(this.h, C.bool(this.isSubclass))
|
2024-10-20 05:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
|
|
|
// from C++ memory once it is unreachable from Go memory.
|
|
|
|
func (this *QWriteLocker) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QWriteLocker) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|