-typedef struct dispatch_kevent_s *dispatch_kevent_t;
-
-struct dispatch_source_type_s {
- struct kevent64_s ke;
- uint64_t mask;
- void (*init)(dispatch_source_t ds, dispatch_source_type_t type,
- uintptr_t handle, unsigned long mask, dispatch_queue_t q);
-};
-
-struct dispatch_timer_source_s {
- uint64_t target;
- uint64_t deadline;
- uint64_t last_fire;
- uint64_t interval;
- uint64_t leeway;
- unsigned long flags; // dispatch_timer_flags_t
- unsigned long missed;
-};
-
-enum {
- DS_EVENT_HANDLER = 0,
- DS_CANCEL_HANDLER,
- DS_REGISTN_HANDLER,
-};
-
-// Source state which may contain references to the source object
-// Separately allocated so that 'leaks' can see sources <rdar://problem/9050566>
-typedef struct dispatch_source_refs_s {
- TAILQ_ENTRY(dispatch_source_refs_s) dr_list;
- uintptr_t dr_source_wref; // "weak" backref to dispatch_source_t
- dispatch_continuation_t ds_handler[3];
-} *dispatch_source_refs_t;
-
-typedef struct dispatch_timer_source_refs_s {
- struct dispatch_source_refs_s _ds_refs;
- struct dispatch_timer_source_s _ds_timer;
- TAILQ_ENTRY(dispatch_timer_source_refs_s) dt_list;
-} *dispatch_timer_source_refs_t;
-
-typedef struct dispatch_timer_source_aggregate_refs_s {
- struct dispatch_timer_source_refs_s _dsa_refs;
- TAILQ_ENTRY(dispatch_timer_source_aggregate_refs_s) dra_list;
- TAILQ_ENTRY(dispatch_timer_source_aggregate_refs_s) dta_list;
-} *dispatch_timer_source_aggregate_refs_t;
-
-#define _dispatch_ptr2wref(ptr) (~(uintptr_t)(ptr))
-#define _dispatch_wref2ptr(ref) ((void*)~(ref))
-#define _dispatch_source_from_refs(dr) \
- ((dispatch_source_t)_dispatch_wref2ptr((dr)->dr_source_wref))
-#define ds_timer(dr) \
- (((dispatch_timer_source_refs_t)(dr))->_ds_timer)
-#define ds_timer_aggregate(ds) \
- ((dispatch_timer_aggregate_t)((ds)->dq_specific_q))
-