mirror of
https://github.com/mappu/miqt.git
synced 2025-01-03 14:18:37 +00:00
155 lines
3.2 KiB
Go
155 lines
3.2 KiB
Go
|
package qt
|
||
|
|
||
|
/*
|
||
|
|
||
|
#cgo CFLAGS: -fPIC
|
||
|
#cgo pkg-config: Qt5Widgets
|
||
|
#include "gen_qreadwritelock.h"
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
*/
|
||
|
import "C"
|
||
|
|
||
|
import (
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
type QReadWriteLock struct {
|
||
|
h *C.QReadWriteLock
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) cPointer() *C.QReadWriteLock {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return this.h
|
||
|
}
|
||
|
|
||
|
func newQReadWriteLock(h *C.QReadWriteLock) *QReadWriteLock {
|
||
|
return &QReadWriteLock{h: h}
|
||
|
}
|
||
|
|
||
|
func newQReadWriteLock_U(h unsafe.Pointer) *QReadWriteLock {
|
||
|
return newQReadWriteLock((*C.QReadWriteLock)(h))
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) LockForRead() {
|
||
|
C.QReadWriteLock_LockForRead(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) TryLockForRead() bool {
|
||
|
ret := C.QReadWriteLock_TryLockForRead(this.h)
|
||
|
return (bool)(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) TryLockForReadWithTimeout(timeout int) bool {
|
||
|
ret := C.QReadWriteLock_TryLockForReadWithTimeout(this.h, (C.int)(timeout))
|
||
|
return (bool)(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) LockForWrite() {
|
||
|
C.QReadWriteLock_LockForWrite(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) TryLockForWrite() bool {
|
||
|
ret := C.QReadWriteLock_TryLockForWrite(this.h)
|
||
|
return (bool)(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) TryLockForWriteWithTimeout(timeout int) bool {
|
||
|
ret := C.QReadWriteLock_TryLockForWriteWithTimeout(this.h, (C.int)(timeout))
|
||
|
return (bool)(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) Unlock() {
|
||
|
C.QReadWriteLock_Unlock(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QReadWriteLock) Delete() {
|
||
|
C.QReadWriteLock_Delete(this.h)
|
||
|
}
|
||
|
|
||
|
type QReadLocker struct {
|
||
|
h *C.QReadLocker
|
||
|
}
|
||
|
|
||
|
func (this *QReadLocker) cPointer() *C.QReadLocker {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return this.h
|
||
|
}
|
||
|
|
||
|
func newQReadLocker(h *C.QReadLocker) *QReadLocker {
|
||
|
return &QReadLocker{h: h}
|
||
|
}
|
||
|
|
||
|
func newQReadLocker_U(h unsafe.Pointer) *QReadLocker {
|
||
|
return newQReadLocker((*C.QReadLocker)(h))
|
||
|
}
|
||
|
|
||
|
// NewQReadLocker constructs a new QReadLocker object.
|
||
|
func NewQReadLocker(readWriteLock *QReadWriteLock) *QReadLocker {
|
||
|
ret := C.QReadLocker_new(readWriteLock.cPointer())
|
||
|
return newQReadLocker(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QReadLocker) Unlock() {
|
||
|
C.QReadLocker_Unlock(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QReadLocker) Relock() {
|
||
|
C.QReadLocker_Relock(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QReadLocker) ReadWriteLock() *QReadWriteLock {
|
||
|
ret := C.QReadLocker_ReadWriteLock(this.h)
|
||
|
return newQReadWriteLock_U(unsafe.Pointer(ret))
|
||
|
}
|
||
|
|
||
|
func (this *QReadLocker) Delete() {
|
||
|
C.QReadLocker_Delete(this.h)
|
||
|
}
|
||
|
|
||
|
type QWriteLocker struct {
|
||
|
h *C.QWriteLocker
|
||
|
}
|
||
|
|
||
|
func (this *QWriteLocker) cPointer() *C.QWriteLocker {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return this.h
|
||
|
}
|
||
|
|
||
|
func newQWriteLocker(h *C.QWriteLocker) *QWriteLocker {
|
||
|
return &QWriteLocker{h: h}
|
||
|
}
|
||
|
|
||
|
func newQWriteLocker_U(h unsafe.Pointer) *QWriteLocker {
|
||
|
return newQWriteLocker((*C.QWriteLocker)(h))
|
||
|
}
|
||
|
|
||
|
// NewQWriteLocker constructs a new QWriteLocker object.
|
||
|
func NewQWriteLocker(readWriteLock *QReadWriteLock) *QWriteLocker {
|
||
|
ret := C.QWriteLocker_new(readWriteLock.cPointer())
|
||
|
return newQWriteLocker(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QWriteLocker) Unlock() {
|
||
|
C.QWriteLocker_Unlock(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QWriteLocker) Relock() {
|
||
|
C.QWriteLocker_Relock(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QWriteLocker) ReadWriteLock() *QReadWriteLock {
|
||
|
ret := C.QWriteLocker_ReadWriteLock(this.h)
|
||
|
return newQReadWriteLock_U(unsafe.Pointer(ret))
|
||
|
}
|
||
|
|
||
|
func (this *QWriteLocker) Delete() {
|
||
|
C.QWriteLocker_Delete(this.h)
|
||
|
}
|