Skip to content

dispatch: adjust for LLP64 environments #341

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
Feb 22, 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
2 changes: 1 addition & 1 deletion dispatch/once.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ __BEGIN_DECLS
* Note: static and global variables default to zero.
*/
DISPATCH_SWIFT3_UNAVAILABLE("Use lazily initialized globals instead")
typedef long dispatch_once_t;
typedef intptr_t dispatch_once_t;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should really be uintptr_t I don't like signed integers for these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I only used intptr_t since it was long which is a signed value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right and since it's API it may cause build fallouts... ok convinced let's keep intptr_t ugh


#if defined(__x86_64__) || defined(__i386__) || defined(__s390x__)
#define DISPATCH_ONCE_INLINE_FASTPATH 1
Expand Down
8 changes: 4 additions & 4 deletions src/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ _dispatch_source_handler_free(dispatch_source_t ds, long kind)

DISPATCH_ALWAYS_INLINE
static inline void
_dispatch_source_handler_replace(dispatch_source_t ds, long kind,
_dispatch_source_handler_replace(dispatch_source_t ds, uintptr_t kind,
dispatch_continuation_t dc)
{
if (!dc->dc_func) {
Expand All @@ -321,14 +321,14 @@ _dispatch_source_set_handler_slow(void *context)
dispatch_assert(dx_type(ds) == DISPATCH_SOURCE_KEVENT_TYPE);

dispatch_continuation_t dc = context;
long kind = (long)dc->dc_data;
void *kind = dc->dc_data;
dc->dc_data = NULL;
_dispatch_source_handler_replace(ds, kind, dc);
_dispatch_source_handler_replace(ds, (uintptr_t)kind, dc);
}

DISPATCH_NOINLINE
static void
_dispatch_source_set_handler(dispatch_source_t ds, long kind,
_dispatch_source_set_handler(dispatch_source_t ds, uintptr_t kind,
dispatch_continuation_t dc)
{
dispatch_assert(dx_type(ds) == DISPATCH_SOURCE_KEVENT_TYPE);
Expand Down