eventlink_internal.h [plain text]
#ifndef __OS_EVENTLINK_INTERNAL__
#define __OS_EVENTLINK_INTERNAL__
#if OS_EVENTLINK_USE_MACH_EVENTLINK
#include <mach/mach_eventlink.h>
#endif
#define OS_EVENTLINK_LABEL_NEEDS_FREE 0x1ull
#define OS_EVENTLINK_CANCELLED 0x2ull
union eventlink_internal {
mach_port_t pair[2];
uint64_t desc;
};
struct os_eventlink_s {
struct _os_object_s _as_os_obj[0];
OS_OBJECT_STRUCT_HEADER(eventlink);
const char *name;
uint64_t ev_state;
union eventlink_internal port_pair;
uint64_t local_count;
};
#define EVENTLINK_INACTIVE_PORT ((uint64_t) 0)
#define EVENTLINK_CLEARED_PORT ((uint64_t) 0)
static inline bool
_os_eventlink_inactive(mach_port_t port)
{
return port == EVENTLINK_INACTIVE_PORT;
}
static inline bool
_os_eventlink_is_cancelled(uint64_t ev_state)
{
return (ev_state & OS_EVENTLINK_CANCELLED) == OS_EVENTLINK_CANCELLED;
}
void _os_eventlink_xref_dispose(os_eventlink_t ev);
void _os_eventlink_dispose(os_eventlink_t ev);
#endif