Skip to content

dispatch: make public interfaces LLP64 friendly #409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dispatch/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ dispatch_block_perform(dispatch_block_flags_t flags,
*/
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
long
intptr_t
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);

/*!
Expand Down Expand Up @@ -415,7 +415,7 @@ dispatch_block_cancel(dispatch_block_t block);
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
long
intptr_t
dispatch_block_testcancel(dispatch_block_t block);

__END_DECLS
Expand Down
2 changes: 1 addition & 1 deletion dispatch/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ dispatch_group_async_f(dispatch_group_t group,
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
long
intptr_t
dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout);

/*!
Expand Down
4 changes: 2 additions & 2 deletions dispatch/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ dispatch_resume(dispatch_object_t object);
*/
DISPATCH_UNAVAILABLE
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
long
intptr_t
dispatch_wait(void *object, dispatch_time_t timeout);
#if __has_extension(c_generic_selections)
#define dispatch_wait(object, timeout) \
Expand Down Expand Up @@ -500,7 +500,7 @@ dispatch_cancel(void *object);
DISPATCH_UNAVAILABLE
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
long
intptr_t
dispatch_testcancel(void *object);
#if __has_extension(c_generic_selections)
#define dispatch_testcancel(object) \
Expand Down
2 changes: 1 addition & 1 deletion dispatch/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ typedef unsigned int dispatch_qos_class_t;
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_CONST DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_queue_t
dispatch_get_global_queue(long identifier, unsigned long flags);
dispatch_get_global_queue(intptr_t identifier, uintptr_t flags);

/*!
* @typedef dispatch_queue_attr_t
Expand Down
6 changes: 3 additions & 3 deletions dispatch/semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
DISPATCH_NOTHROW
dispatch_semaphore_t
dispatch_semaphore_create(long value);
dispatch_semaphore_create(intptr_t value);

/*!
* @function dispatch_semaphore_wait
Expand All @@ -85,7 +85,7 @@ dispatch_semaphore_create(long value);
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
long
intptr_t
dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);

/*!
Expand All @@ -107,7 +107,7 @@ dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout);
*/
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
long
intptr_t
dispatch_semaphore_signal(dispatch_semaphore_t dsema);

__END_DECLS
Expand Down
10 changes: 5 additions & 5 deletions dispatch/source.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ DISPATCH_NOTHROW
dispatch_source_t
dispatch_source_create(dispatch_source_type_t type,
uintptr_t handle,
unsigned long mask,
uintptr_t mask,
dispatch_queue_t _Nullable queue);

/*!
Expand Down Expand Up @@ -530,7 +530,7 @@ dispatch_source_cancel(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
long
intptr_t
dispatch_source_testcancel(dispatch_source_t source);

/*!
Expand Down Expand Up @@ -592,7 +592,7 @@ dispatch_source_get_handle(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
unsigned long
uintptr_t
dispatch_source_get_mask(dispatch_source_t source);

/*!
Expand Down Expand Up @@ -630,7 +630,7 @@ dispatch_source_get_mask(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
unsigned long
uintptr_t
dispatch_source_get_data(dispatch_source_t source);

/*!
Expand All @@ -652,7 +652,7 @@ dispatch_source_get_data(dispatch_source_t source);
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_source_merge_data(dispatch_source_t source, unsigned long value);
dispatch_source_merge_data(dispatch_source_t source, uintptr_t value);

/*!
* @function dispatch_source_set_timer
Expand Down
16 changes: 8 additions & 8 deletions src/event/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
DISPATCH_NOINLINE
static dispatch_unote_t
_dispatch_unote_create(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask)
uintptr_t handle, uintptr_t mask)
{
dispatch_unote_linkage_t dul;
dispatch_unote_class_t du;
Expand Down Expand Up @@ -60,7 +60,7 @@ _dispatch_unote_create(dispatch_source_type_t dst,
DISPATCH_NOINLINE
dispatch_unote_t
_dispatch_unote_create_with_handle(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask)
uintptr_t handle, uintptr_t mask)
{
if (!handle) {
return DISPATCH_UNOTE_NULL;
Expand All @@ -71,7 +71,7 @@ _dispatch_unote_create_with_handle(dispatch_source_type_t dst,
DISPATCH_NOINLINE
dispatch_unote_t
_dispatch_unote_create_with_fd(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask)
uintptr_t handle, uintptr_t mask)
{
#if !TARGET_OS_MAC // <rdar://problem/27756657>
if (handle > INT_MAX) {
Expand All @@ -90,7 +90,7 @@ _dispatch_unote_create_with_fd(dispatch_source_type_t dst,
DISPATCH_NOINLINE
dispatch_unote_t
_dispatch_unote_create_without_handle(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask)
uintptr_t handle, uintptr_t mask)
{
if (handle) {
return DISPATCH_UNOTE_NULL;
Expand Down Expand Up @@ -127,7 +127,7 @@ _dispatch_unote_dispose(dispatch_unote_t du)

static dispatch_unote_t
_dispatch_source_data_create(dispatch_source_type_t dst, uintptr_t handle,
unsigned long mask)
uintptr_t mask)
{
if (handle || mask) {
return DISPATCH_UNOTE_NULL;
Expand Down Expand Up @@ -210,7 +210,7 @@ const dispatch_source_type_s _dispatch_source_type_write = {

static dispatch_unote_t
_dispatch_source_signal_create(dispatch_source_type_t dst, uintptr_t handle,
unsigned long mask)
uintptr_t mask)
{
if (handle >= NSIG) {
return DISPATCH_UNOTE_NULL;
Expand Down Expand Up @@ -261,14 +261,14 @@ struct dispatch_timer_heap_s _dispatch_timers_heap[] = {

static dispatch_unote_t
_dispatch_source_timer_create(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask)
uintptr_t handle, uintptr_t mask)
{
uint32_t fflags = dst->dst_fflags;
dispatch_unote_t du;

// normalize flags
if (mask & DISPATCH_TIMER_STRICT) {
mask &= ~(unsigned long)DISPATCH_TIMER_BACKGROUND;
mask &= ~(uintptr_t)DISPATCH_TIMER_BACKGROUND;
}

if (fflags & DISPATCH_TIMER_INTERVAL) {
Expand Down
8 changes: 4 additions & 4 deletions src/event/event_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ typedef struct dispatch_source_type_s {
#endif

dispatch_unote_t (*dst_create)(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask);
uintptr_t handle, uintptr_t mask);
#if DISPATCH_EVENT_BACKEND_KEVENT
bool (*dst_update_mux)(struct dispatch_muxnote_s *dmn);
#endif
Expand Down Expand Up @@ -406,11 +406,11 @@ extern uint32_t _dispatch_timers_will_wake;
#endif

dispatch_unote_t _dispatch_unote_create_with_handle(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask);
uintptr_t handle, uintptr_t mask);
dispatch_unote_t _dispatch_unote_create_with_fd(dispatch_source_type_t dst,
uintptr_t handle, unsigned long mask);
uintptr_t handle, uintptr_t mask);
dispatch_unote_t _dispatch_unote_create_without_handle(
dispatch_source_type_t dst, uintptr_t handle, unsigned long mask);
dispatch_source_type_t dst, uintptr_t handle, uintptr_t mask);

bool _dispatch_unote_register(dispatch_unote_t du, dispatch_wlh_t wlh,
dispatch_priority_t pri);
Expand Down
10 changes: 5 additions & 5 deletions src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@ struct dispatch_queue_s _dispatch_mgr_q = {
};

dispatch_queue_t
dispatch_get_global_queue(long priority, unsigned long flags)
dispatch_get_global_queue(intptr_t priority, uintptr_t flags)
{
if (flags & ~(unsigned long)DISPATCH_QUEUE_OVERCOMMIT) {
if (flags & ~(uintptr_t)DISPATCH_QUEUE_OVERCOMMIT) {
return DISPATCH_BAD_INPUT;
}
dispatch_qos_t qos = _dispatch_qos_from_queue_priority(priority);
Expand Down Expand Up @@ -3267,7 +3267,7 @@ dispatch_block_cancel(dispatch_block_t db)
(void)os_atomic_or2o(dbpd, dbpd_atomic_flags, DBF_CANCELED, relaxed);
}

long
intptr_t
dispatch_block_testcancel(dispatch_block_t db)
{
dispatch_block_private_data_t dbpd = _dispatch_block_get_data(db);
Expand All @@ -3278,7 +3278,7 @@ dispatch_block_testcancel(dispatch_block_t db)
return (bool)(dbpd->dbpd_atomic_flags & DBF_CANCELED);
}

long
intptr_t
dispatch_block_wait(dispatch_block_t db, dispatch_time_t timeout)
{
dispatch_block_private_data_t dbpd = _dispatch_block_get_data(db);
Expand Down Expand Up @@ -3324,7 +3324,7 @@ dispatch_block_wait(dispatch_block_t db, dispatch_time_t timeout)
"run more than once and waited for");
}

long ret = dispatch_group_wait(_dbpd_group(dbpd), timeout);
intptr_t ret = dispatch_group_wait(_dbpd_group(dbpd), timeout);

if (boost_th) {
_dispatch_thread_override_end(boost_th, dbpd);
Expand Down
20 changes: 10 additions & 10 deletions src/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
#include "internal.h"

DISPATCH_WEAK // rdar://problem/8503746
long _dispatch_semaphore_signal_slow(dispatch_semaphore_t dsema);
intptr_t _dispatch_semaphore_signal_slow(dispatch_semaphore_t dsema);

#pragma mark -
#pragma mark dispatch_semaphore_class_t

static void
_dispatch_semaphore_class_init(long value, dispatch_semaphore_class_t dsemau)
_dispatch_semaphore_class_init(intptr_t value, dispatch_semaphore_class_t dsemau)
{
struct dispatch_semaphore_header_s *dsema = dsemau._dsema_hdr;

Expand All @@ -41,7 +41,7 @@ _dispatch_semaphore_class_init(long value, dispatch_semaphore_class_t dsemau)
#pragma mark dispatch_semaphore_t

dispatch_semaphore_t
dispatch_semaphore_create(long value)
dispatch_semaphore_create(intptr_t value)
{
dispatch_semaphore_t dsema;

Expand Down Expand Up @@ -92,15 +92,15 @@ _dispatch_semaphore_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
}

DISPATCH_NOINLINE
long
intptr_t
_dispatch_semaphore_signal_slow(dispatch_semaphore_t dsema)
{
_dispatch_sema4_create(&dsema->dsema_sema, _DSEMA4_POLICY_FIFO);
_dispatch_sema4_signal(&dsema->dsema_sema, 1);
return 1;
}

long
intptr_t
dispatch_semaphore_signal(dispatch_semaphore_t dsema)
{
long value = os_atomic_inc2o(dsema, dsema_value, release);
Expand All @@ -115,7 +115,7 @@ dispatch_semaphore_signal(dispatch_semaphore_t dsema)
}

DISPATCH_NOINLINE
static long
static intptr_t
_dispatch_semaphore_wait_slow(dispatch_semaphore_t dsema,
dispatch_time_t timeout)
{
Expand Down Expand Up @@ -146,7 +146,7 @@ _dispatch_semaphore_wait_slow(dispatch_semaphore_t dsema,
return 0;
}

long
intptr_t
dispatch_semaphore_wait(dispatch_semaphore_t dsema, dispatch_time_t timeout)
{
long value = os_atomic_dec2o(dsema, dsema_value, acquire);
Expand Down Expand Up @@ -198,7 +198,7 @@ dispatch_group_enter(dispatch_group_t dg)
}

DISPATCH_NOINLINE
static long
static intptr_t
_dispatch_group_wake(dispatch_group_t dg, bool needs_release)
{
dispatch_continuation_t next, head, tail = NULL;
Expand Down Expand Up @@ -277,7 +277,7 @@ _dispatch_group_debug(dispatch_object_t dou, char *buf, size_t bufsiz)
}

DISPATCH_NOINLINE
static long
static intptr_t
_dispatch_group_wait_slow(dispatch_group_t dg, dispatch_time_t timeout)
{
long value;
Expand Down Expand Up @@ -325,7 +325,7 @@ _dispatch_group_wait_slow(dispatch_group_t dg, dispatch_time_t timeout)
return 0;
}

long
intptr_t
dispatch_group_wait(dispatch_group_t dg, dispatch_time_t timeout)
{
if (dg->dg_value == 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/semaphore_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct dispatch_queue_s;

#define DISPATCH_SEMAPHORE_HEADER(cls, ns) \
DISPATCH_OBJECT_HEADER(cls); \
long volatile ns##_value; \
intptr_t volatile ns##_value; \
_dispatch_sema4_t ns##_sema

struct dispatch_semaphore_header_s {
Expand All @@ -41,7 +41,7 @@ struct dispatch_semaphore_header_s {
DISPATCH_CLASS_DECL(semaphore);
struct dispatch_semaphore_s {
DISPATCH_SEMAPHORE_HEADER(semaphore, dsema);
long dsema_orig;
intptr_t dsema_orig;
};

DISPATCH_CLASS_DECL(group);
Expand Down
2 changes: 1 addition & 1 deletion src/shims/priority.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ _dispatch_qos_to_qos_class(dispatch_qos_t qos)

DISPATCH_ALWAYS_INLINE
static inline dispatch_qos_t
_dispatch_qos_from_queue_priority(long priority)
_dispatch_qos_from_queue_priority(intptr_t priority)
{
switch (priority) {
case DISPATCH_QUEUE_PRIORITY_BACKGROUND: return DISPATCH_QOS_BACKGROUND;
Expand Down
Loading