Skip to content

Commit 662b0ef

Browse files
committed
Missing pieces required for building as /usr/lib/system/libdispatch.dylib on OSX El Capitan
1 parent 50e1003 commit 662b0ef

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

src/queue.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,6 @@ dispatch_assert_queue_not(dispatch_queue_t dq)
711711
#pragma mark dispatch_init
712712

713713
#if HAVE_PTHREAD_WORKQUEUE_QOS
714-
int _dispatch_set_qos_class_enabled;
715714
pthread_priority_t _dispatch_background_priority;
716715
pthread_priority_t _dispatch_user_initiated_priority;
717716

@@ -1651,6 +1650,21 @@ dispatch_pthread_root_queue_create(const char *label, unsigned long flags,
16511650
NULL);
16521651
}
16531652

1653+
#if DISPATCH_IOHID_SPI
1654+
dispatch_queue_t
1655+
_dispatch_pthread_root_queue_create_with_observer_hooks_4IOHID(const char *label,
1656+
unsigned long flags, const pthread_attr_t *attr,
1657+
dispatch_pthread_root_queue_observer_hooks_t observer_hooks,
1658+
dispatch_block_t configure)
1659+
{
1660+
if (!observer_hooks->queue_will_execute ||
1661+
!observer_hooks->queue_did_execute) {
1662+
DISPATCH_CLIENT_CRASH("Invalid pthread root queue observer hooks");
1663+
}
1664+
return _dispatch_pthread_root_queue_create(label, flags, attr, configure,
1665+
observer_hooks);
1666+
}
1667+
#endif
16541668

16551669
#endif // DISPATCH_ENABLE_PTHREAD_ROOT_QUEUES
16561670

@@ -1842,6 +1856,17 @@ dispatch_get_specific(const void *key)
18421856
return ctxt;
18431857
}
18441858

1859+
#if DISPATCH_IOHID_SPI
1860+
bool
1861+
_dispatch_queue_is_exclusively_owned_by_current_thread_4IOHID(
1862+
dispatch_queue_t dq) // rdar://problem/18033810
1863+
{
1864+
if (dq->dq_width > 1) {
1865+
DISPATCH_CLIENT_CRASH("Invalid queue type");
1866+
}
1867+
return (dq->dq_thread && dq->dq_thread == _dispatch_thread_port());
1868+
}
1869+
#endif
18451870

18461871
#pragma mark -
18471872
#pragma mark dispatch_queue_debug

src/queue_internal.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,4 +379,29 @@ void _dispatch_block_invoke(const struct dispatch_block_private_data_s *dbcpd);
379379

380380
#endif /* __BLOCKS__ */
381381

382+
typedef struct dispatch_pthread_root_queue_observer_hooks_s {
383+
void (*queue_will_execute)(dispatch_queue_t queue);
384+
void (*queue_did_execute)(dispatch_queue_t queue);
385+
} dispatch_pthread_root_queue_observer_hooks_s;
386+
typedef dispatch_pthread_root_queue_observer_hooks_s
387+
*dispatch_pthread_root_queue_observer_hooks_t;
388+
389+
#ifdef __APPLE__
390+
#define DISPATCH_IOHID_SPI 1
391+
392+
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
393+
DISPATCH_NOTHROW DISPATCH_NONNULL4
394+
dispatch_queue_t
395+
_dispatch_pthread_root_queue_create_with_observer_hooks_4IOHID(
396+
const char *label, unsigned long flags, const pthread_attr_t *attr,
397+
dispatch_pthread_root_queue_observer_hooks_t observer_hooks,
398+
dispatch_block_t configure);
399+
400+
DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW
401+
bool
402+
_dispatch_queue_is_exclusively_owned_by_current_thread_4IOHID(
403+
dispatch_queue_t queue);
404+
405+
#endif // __APPLE__
406+
382407
#endif

0 commit comments

Comments
 (0)