Skip to content

Commit f2b865b

Browse files
committed
address issues raised
1 parent 93c9f74 commit f2b865b

File tree

4 files changed

+111
-128
lines changed

4 files changed

+111
-128
lines changed

src/internal.h

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,13 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
228228
#endif
229229
#include <limits.h>
230230
#include <search.h>
231-
#if USE_POSIX_SEM
232-
#include <semaphore.h>
233-
#elif USE_FUTEX_SEM
231+
#if USE_FUTEX_SEM
234232
#include <sys/syscall.h>
235233
#include <linux/futex.h>
236234
#endif
235+
#if USE_POSIX_SEM
236+
#include <semaphore.h>
237+
#endif
237238

238239
#include <signal.h>
239240
#include <stdarg.h>
@@ -246,33 +247,23 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
246247
#include <unistd.h>
247248
#endif
248249

249-
#if USE_POSIX_SEM
250-
#include <semaphore.h>
251-
#elif USE_FUTEX_SEM
252-
#include <sys/syscall.h>
253-
#include <linux/futex.h>
254-
#endif
255-
256250
#if defined(__APPLE__)
257251
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
258252
#define DISPATCH_LITTLE_ENDIAN
259253
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
260254
#define DISPATCH_BIG_ENDIAN
261255
#endif
262-
263-
#elif defined(__linux__)
256+
#else
264257
#include <endian.h>
265258
#if __BYTE_ORDER == __LITTLE_ENDIAN
266259
#define DISPATCH_LITTLE_ENDIAN
267260
#elif __BYTE_ORDER == __BIG_ENDIAN
268261
#define DISPATCH_BIG_ENDIAN
262+
#else
263+
#error "please define DISPATCH_LITTLE_ENDIAN or DISPATCH_BIG_ENDIAN for your architecture / platform"
269264
#endif
270-
271265
#endif /* defined(__APPLE__) */
272266

273-
#if !(defined(DISPATCH_BIG_ENDIAN) || defined(DISPATCH_LITTLE_ENDIAN))
274-
#error "Unable to determine platform endianness."
275-
#endif
276267

277268
#ifndef __has_builtin
278269
#define __has_builtin(x) 0

src/queue.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,7 @@ _dispatch_root_queue_init_pthread_pool(dispatch_root_queue_context_t qc,
880880
int ret = sem_init(&(pqc->dpq_thread_mediator.dsema_sem), 0, 0);
881881
(void)dispatch_assume_zero(ret);
882882
#elif USE_FUTEX_SEM
883-
int ret = _dispatch_futex_init(&(pqc->dpq_thread_mediator.dsema_futex));
884-
(void)dispatch_assume_zero(ret);
883+
pqc->dpq_thread_mediator.dsema_futex = DISPATCH_FUTEX_INIT;
885884
#endif
886885
}
887886
#endif // DISPATCH_USE_PTHREAD_POOL

0 commit comments

Comments
 (0)