Documentation
¶
Overview ¶
Package dispatch provides an idiomatic Go wrapper over the raw dispatch C-library bindings: opaque handles become typed wrappers with methods, the C symbol prefix is stripped, and OSStatus/kern_return_t results become Go errors.
Index ¶
- Constants
- func AfterF(when uint64, queue Queue, context_ unsafe.Pointer, work unsafe.Pointer)
- func AllowSendSignals(preserve_signum int32) int32
- func ApplyF(iterations uint64, queue Queue, context_ unsafe.Pointer, work unsafe.Pointer)
- func GetSpecific(key unsafe.Pointer) unsafe.Pointer
- func Main()
- func OnceF(predicate *int64, context_ unsafe.Pointer, function unsafe.Pointer)
- func Time(when uint64, delta int64) uint64
- func Walltime(when *bsd.Timespec, delta int64) uint64
- type Data
- func (h Data) CopyRegion(location uint64, offset_ptr *uint64) Data
- func (h Data) CreateConcat(data2 Data) Data
- func (h Data) CreateMap(buffer_ptr unsafe.Pointer, size_ptr *uint64) Data
- func (h Data) CreateSubrange(offset uint64, length uint64) Data
- func (h Data) GetSize() uint64
- func (h Data) Ptr() unsafe.Pointer
- type Dispatch_autorelease_frequency_t
- type Dispatch_block_flags_t
- type Dispatch_data_s
- type Dispatch_queue_attr_s
- type Dispatch_queue_s
- type Dispatch_source_type_t
- type Filesec_property_t
- type Group
- type Idtype_t
- type Io
- type Mpo_flags_t
- type OS_dispatch_data
- type OS_dispatch_group
- type OS_dispatch_io
- type OS_dispatch_object
- type OS_dispatch_queue
- type OS_dispatch_queue_attr
- type OS_dispatch_queue_concurrent
- type OS_dispatch_queue_global
- type OS_dispatch_queue_main
- type OS_dispatch_queue_serial
- type OS_dispatch_queue_serial_executor
- type OS_dispatch_semaphore
- type OS_dispatch_source
- type OS_dispatch_workloop
- type Object
- func (h Object) Activate()
- func (h Object) GetContext() unsafe.Pointer
- func (h Object) Ptr() unsafe.Pointer
- func (h Object) Release()
- func (h Object) Resume()
- func (h Object) Retain()
- func (h Object) SetContext(context_ unsafe.Pointer)
- func (h Object) SetFinalizerF(finalizer unsafe.Pointer)
- func (h Object) SetQosClassFloor(qos_class raw.Qos_class_t, relative_priority int32)
- func (h Object) SetTargetQueue(queue Queue)
- func (h Object) Suspend()
- type OsWorkgroup
- type Os_clockid_t
- type Qos_class_t
- type Queue
- func (h Queue) AssertQueue()
- func (h Queue) AssertQueueBarrier()
- func (h Queue) AssertQueueNot()
- func (h Queue) AsyncAndWaitF(context_ unsafe.Pointer, work unsafe.Pointer)
- func (h Queue) AsyncF(context_ unsafe.Pointer, work unsafe.Pointer)
- func (h Queue) BarrierAsyncAndWaitF(context_ unsafe.Pointer, work unsafe.Pointer)
- func (h Queue) BarrierAsyncF(context_ unsafe.Pointer, work unsafe.Pointer)
- func (h Queue) BarrierSyncF(context_ unsafe.Pointer, work unsafe.Pointer)
- func (h Queue) GetLabel() string
- func (h Queue) GetQosClass(relative_priority_ptr *int32) raw.Qos_class_t
- func (h Queue) GetSpecific(key unsafe.Pointer) unsafe.Pointer
- func (h Queue) Ptr() unsafe.Pointer
- func (h Queue) SetSpecific(key unsafe.Pointer, context_ unsafe.Pointer, destructor unsafe.Pointer)
- func (h Queue) SyncF(context_ unsafe.Pointer, work unsafe.Pointer)
- type QueueAttr
- type QueueGlobal
- type QueueMain
- type Semaphore
- type Source
- func (h Source) Cancel()
- func (h Source) GetData() uint64
- func (h Source) GetHandle() uint64
- func (h Source) GetMask() uint64
- func (h Source) MergeData(value uint64)
- func (h Source) Ptr() unsafe.Pointer
- func (h Source) SetCancelHandlerF(handler unsafe.Pointer)
- func (h Source) SetEventHandlerF(handler unsafe.Pointer)
- func (h Source) SetRegistrationHandlerF(handler unsafe.Pointer)
- func (h Source) SetTimer(start uint64, interval uint64, leeway uint64)
- func (h Source) Testcancel() int64
- type Timespec
- type Workloop
Constants ¶
const ( DISPATCH_AUTORELEASE_FREQUENCY_INHERIT = raw.DISPATCH_AUTORELEASE_FREQUENCY_INHERIT DISPATCH_AUTORELEASE_FREQUENCY_NEVER = raw.DISPATCH_AUTORELEASE_FREQUENCY_NEVER DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM = raw.DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM DISPATCH_BLOCK_ASSIGN_CURRENT = raw.DISPATCH_BLOCK_ASSIGN_CURRENT DISPATCH_BLOCK_BARRIER = raw.DISPATCH_BLOCK_BARRIER DISPATCH_BLOCK_DETACHED = raw.DISPATCH_BLOCK_DETACHED DISPATCH_BLOCK_ENFORCE_QOS_CLASS = raw.DISPATCH_BLOCK_ENFORCE_QOS_CLASS DISPATCH_BLOCK_INHERIT_QOS_CLASS = raw.DISPATCH_BLOCK_INHERIT_QOS_CLASS DISPATCH_BLOCK_NO_QOS_CLASS = raw.DISPATCH_BLOCK_NO_QOS_CLASS DISPATCH_WALLTIME_NOW = raw.DISPATCH_WALLTIME_NOW FILESEC_ACL = raw.FILESEC_ACL FILESEC_ACL_ALLOCSIZE = raw.FILESEC_ACL_ALLOCSIZE FILESEC_ACL_RAW = raw.FILESEC_ACL_RAW FILESEC_GROUP = raw.FILESEC_GROUP FILESEC_GRPUUID = raw.FILESEC_GRPUUID FILESEC_MODE = raw.FILESEC_MODE FILESEC_OWNER = raw.FILESEC_OWNER FILESEC_UUID = raw.FILESEC_UUID MPO_CONNECTION_PORT = raw.MPO_CONNECTION_PORT MPO_CONNECTION_PORT_WITH_PORT_ARRAY = raw.MPO_CONNECTION_PORT_WITH_PORT_ARRAY MPO_EXCEPTION_PORT = raw.MPO_EXCEPTION_PORT MPO_NOTIFICATION_PORT = raw.MPO_NOTIFICATION_PORT MPO_PORT = raw.MPO_PORT MPO_REPLY_PORT = raw.MPO_REPLY_PORT MPO_SERVICE_PORT = raw.MPO_SERVICE_PORT MPO_WEAK_REPLY_PORT = raw.MPO_WEAK_REPLY_PORT OS_CLOCK_MACH_ABSOLUTE_TIME = raw.OS_CLOCK_MACH_ABSOLUTE_TIME P_ALL = raw.P_ALL P_PGID = raw.P_PGID P_PID = raw.P_PID QOS_CLASS_BACKGROUND = raw.QOS_CLASS_BACKGROUND QOS_CLASS_DEFAULT = raw.QOS_CLASS_DEFAULT QOS_CLASS_UNSPECIFIED = raw.QOS_CLASS_UNSPECIFIED QOS_CLASS_USER_INITIATED = raw.QOS_CLASS_USER_INITIATED QOS_CLASS_USER_INTERACTIVE = raw.QOS_CLASS_USER_INTERACTIVE QOS_CLASS_UTILITY = raw.QOS_CLASS_UTILITY )
Variables ¶
This section is empty.
Functions ¶
func AllowSendSignals ¶ added in v0.17.0
Types ¶
type Data ¶ added in v0.17.0
type Data struct {
// contains filtered or unexported fields
}
Data wraps the C handle dispatch_data_t.
func (Data) CopyRegion ¶ added in v0.17.0
func (Data) CreateConcat ¶ added in v0.17.0
func (Data) CreateSubrange ¶ added in v0.17.0
type Dispatch_autorelease_frequency_t ¶
type Dispatch_autorelease_frequency_t = raw.Dispatch_autorelease_frequency_t
type Dispatch_block_flags_t ¶
type Dispatch_block_flags_t = raw.Dispatch_block_flags_t
type Dispatch_data_s ¶
type Dispatch_data_s = raw.Dispatch_data_s
type Dispatch_queue_attr_s ¶
type Dispatch_queue_attr_s = raw.Dispatch_queue_attr_s
type Dispatch_queue_s ¶
type Dispatch_queue_s = raw.Dispatch_queue_s
type Dispatch_source_type_t ¶
type Dispatch_source_type_t = raw.Dispatch_source_type_t
type Filesec_property_t ¶
type Filesec_property_t = raw.Filesec_property_t
type Group ¶ added in v0.17.0
type Group struct {
// contains filtered or unexported fields
}
Group wraps the C handle dispatch_group_t.
func GroupCreate ¶ added in v0.17.0
func GroupCreate() Group
type Io ¶ added in v0.17.0
type Io struct {
// contains filtered or unexported fields
}
Io wraps the C handle dispatch_io_t.
func (Io) GetDescriptor ¶ added in v0.17.0
func (Io) SetHighWater ¶ added in v0.17.0
func (Io) SetInterval ¶ added in v0.17.0
func (Io) SetLowWater ¶ added in v0.17.0
type Mpo_flags_t ¶
type Mpo_flags_t = raw.Mpo_flags_t
type OS_dispatch_data ¶
type OS_dispatch_data = raw.OS_dispatch_data
type OS_dispatch_group ¶
type OS_dispatch_group = raw.OS_dispatch_group
type OS_dispatch_io ¶
type OS_dispatch_io = raw.OS_dispatch_io
type OS_dispatch_object ¶
type OS_dispatch_object = raw.OS_dispatch_object
type OS_dispatch_queue ¶
type OS_dispatch_queue = raw.OS_dispatch_queue
type OS_dispatch_queue_attr ¶
type OS_dispatch_queue_attr = raw.OS_dispatch_queue_attr
type OS_dispatch_queue_concurrent ¶
type OS_dispatch_queue_concurrent = raw.OS_dispatch_queue_concurrent
type OS_dispatch_queue_global ¶
type OS_dispatch_queue_global = raw.OS_dispatch_queue_global
type OS_dispatch_queue_main ¶
type OS_dispatch_queue_main = raw.OS_dispatch_queue_main
type OS_dispatch_queue_serial ¶
type OS_dispatch_queue_serial = raw.OS_dispatch_queue_serial
type OS_dispatch_queue_serial_executor ¶
type OS_dispatch_queue_serial_executor = raw.OS_dispatch_queue_serial_executor
type OS_dispatch_semaphore ¶
type OS_dispatch_semaphore = raw.OS_dispatch_semaphore
type OS_dispatch_source ¶
type OS_dispatch_source = raw.OS_dispatch_source
type OS_dispatch_workloop ¶
type OS_dispatch_workloop = raw.OS_dispatch_workloop
type Object ¶ added in v0.17.0
type Object struct {
// contains filtered or unexported fields
}
Object wraps the C handle dispatch_object_t.
func WrapObject ¶ added in v0.17.0
WrapObject adopts an existing dispatch_object_t handle.
func (Object) GetContext ¶ added in v0.17.0
func (Object) SetContext ¶ added in v0.17.0
func (Object) SetFinalizerF ¶ added in v0.17.0
func (Object) SetQosClassFloor ¶ added in v0.17.0
func (h Object) SetQosClassFloor(qos_class raw.Qos_class_t, relative_priority int32)
func (Object) SetTargetQueue ¶ added in v0.17.0
type OsWorkgroup ¶ added in v0.17.0
type OsWorkgroup struct {
// contains filtered or unexported fields
}
OsWorkgroup wraps the C handle os_workgroup_t.
func WrapOsWorkgroup ¶ added in v0.17.0
func WrapOsWorkgroup(p unsafe.Pointer) OsWorkgroup
WrapOsWorkgroup adopts an existing os_workgroup_t handle.
func (OsWorkgroup) Ptr ¶ added in v0.17.0
func (h OsWorkgroup) Ptr() unsafe.Pointer
Ptr returns the underlying os_workgroup_t handle.
type Os_clockid_t ¶
type Os_clockid_t = raw.Os_clockid_t
type Qos_class_t ¶
type Qos_class_t = raw.Qos_class_t
type Queue ¶ added in v0.17.0
type Queue struct {
// contains filtered or unexported fields
}
Queue wraps the C handle dispatch_queue_t.
func GetCurrentQueue ¶ added in v0.17.0
func GetCurrentQueue() Queue
func QueueCreate ¶ added in v0.17.0
func QueueCreateWithTarget ¶ added in v0.17.0
func (Queue) AssertQueue ¶ added in v0.17.0
func (h Queue) AssertQueue()
func (Queue) AssertQueueBarrier ¶ added in v0.17.0
func (h Queue) AssertQueueBarrier()
func (Queue) AssertQueueNot ¶ added in v0.17.0
func (h Queue) AssertQueueNot()
func (Queue) AsyncAndWaitF ¶ added in v0.17.0
func (Queue) BarrierAsyncAndWaitF ¶ added in v0.17.0
func (Queue) BarrierAsyncF ¶ added in v0.17.0
func (Queue) BarrierSyncF ¶ added in v0.17.0
func (Queue) GetQosClass ¶ added in v0.17.0
func (h Queue) GetQosClass(relative_priority_ptr *int32) raw.Qos_class_t
func (Queue) GetSpecific ¶ added in v0.17.0
func (Queue) SetSpecific ¶ added in v0.17.0
type QueueAttr ¶ added in v0.17.0
type QueueAttr struct {
// contains filtered or unexported fields
}
QueueAttr wraps the C handle dispatch_queue_attr_t.
func WrapQueueAttr ¶ added in v0.17.0
WrapQueueAttr adopts an existing dispatch_queue_attr_t handle.
func (QueueAttr) MakeInitiallyInactive ¶ added in v0.17.0
func (QueueAttr) MakeWithAutoreleaseFrequency ¶ added in v0.17.0
func (h QueueAttr) MakeWithAutoreleaseFrequency(frequency raw.Dispatch_autorelease_frequency_t) QueueAttr
func (QueueAttr) MakeWithQosClass ¶ added in v0.17.0
func (h QueueAttr) MakeWithQosClass(qos_class raw.Qos_class_t, relative_priority int32) QueueAttr
type QueueGlobal ¶ added in v0.17.0
type QueueGlobal struct {
// contains filtered or unexported fields
}
QueueGlobal wraps the C handle dispatch_queue_global_t.
func GetGlobalQueue ¶ added in v0.17.0
func GetGlobalQueue(identifier int64, flags uint64) QueueGlobal
func WrapQueueGlobal ¶ added in v0.17.0
func WrapQueueGlobal(p unsafe.Pointer) QueueGlobal
WrapQueueGlobal adopts an existing dispatch_queue_global_t handle.
func (QueueGlobal) Ptr ¶ added in v0.17.0
func (h QueueGlobal) Ptr() unsafe.Pointer
Ptr returns the underlying dispatch_queue_global_t handle.
type QueueMain ¶ added in v0.17.0
type QueueMain struct {
// contains filtered or unexported fields
}
QueueMain wraps the C handle dispatch_queue_main_t.
func GetMainQueue ¶ added in v0.17.0
func GetMainQueue() QueueMain
func WrapQueueMain ¶ added in v0.17.0
WrapQueueMain adopts an existing dispatch_queue_main_t handle.
type Semaphore ¶ added in v0.17.0
type Semaphore struct {
// contains filtered or unexported fields
}
Semaphore wraps the C handle dispatch_semaphore_t.
func SemaphoreCreate ¶ added in v0.17.0
func WrapSemaphore ¶ added in v0.17.0
WrapSemaphore adopts an existing dispatch_semaphore_t handle.
type Source ¶ added in v0.17.0
type Source struct {
// contains filtered or unexported fields
}
Source wraps the C handle dispatch_source_t.
func SourceCreate ¶ added in v0.17.0
func WrapSource ¶ added in v0.17.0
WrapSource adopts an existing dispatch_source_t handle.
func (Source) SetCancelHandlerF ¶ added in v0.17.0
func (Source) SetEventHandlerF ¶ added in v0.17.0
func (Source) SetRegistrationHandlerF ¶ added in v0.17.0
func (Source) Testcancel ¶ added in v0.17.0
type Workloop ¶ added in v0.17.0
type Workloop struct {
// contains filtered or unexported fields
}
Workloop wraps the C handle dispatch_workloop_t.
func WorkloopCreate ¶ added in v0.17.0
func WorkloopCreateInactive ¶ added in v0.17.0
func WrapWorkloop ¶ added in v0.17.0
WrapWorkloop adopts an existing dispatch_workloop_t handle.
func (Workloop) SetAutoreleaseFrequency ¶ added in v0.17.0
func (h Workloop) SetAutoreleaseFrequency(frequency raw.Dispatch_autorelease_frequency_t)
func (Workloop) SetOsWorkgroup ¶ added in v0.17.0
func (h Workloop) SetOsWorkgroup(workgroup OsWorkgroup)