Skip to content

Commit

Permalink
Merge libdispatch-743
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
  • Loading branch information
das committed Feb 21, 2017
1 parent 13aebd2 commit ff7dc5b
Show file tree
Hide file tree
Showing 89 changed files with 10,806 additions and 9,824 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "libpwq"]
path = libpwq
url = https://github.com/mheily/libpwq.git
[submodule "libkqueue"]
path = libkqueue
url = https://github.com/mheily/libkqueue.git
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ on Ubuntu; currently supported versions are 14.04, 15.10 and 16.04.
`sudo apt-get install systemtap-sdt-dev`

1c. Install additional libdispatch dependencies
`sudo apt-get install libblocksruntime-dev libkqueue-dev libbsd-dev`
`sudo apt-get install libblocksruntime-dev libbsd-dev`

Note: compiling libdispatch requires clang 3.8 or better and
the gold linker. If the default clang on your Ubuntu version is
Expand Down
11 changes: 11 additions & 0 deletions config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
you don't. */
#define HAVE_DECL_CLOCK_MONOTONIC 0

/* Define to 1 if you have the declaration of `CLOCK_REALTIME', and to 0 if
you don't. */
#define CLOCK_REALTIME 0

/* Define to 1 if you have the declaration of `CLOCK_UPTIME', and to 0 if you
don't. */
#define HAVE_DECL_CLOCK_UPTIME 0

/* Define to 1 if you have the declaration of `HAVE_DECL_CLOCK_UPTIME_FAST',
and to 0 if you don't. */
#define HAVE_DECL_CLOCK_UPTIME_FAST 0

/* Define to 1 if you have the declaration of `FD_COPY', and to 0 if you
don't. */
#define HAVE_DECL_FD_COPY 1
Expand Down Expand Up @@ -87,6 +95,9 @@
/* Define to 1 if you have the `mach_absolute_time' function. */
#define HAVE_MACH_ABSOLUTE_TIME 1

/* Define to 1 if you have the `mach_approximate_time' function. */
#define HAVE_MACH_APPROXIMATE_TIME 1

/* Define to 1 if you have the `mach_port_construct' function. */
#define HAVE_MACH_PORT_CONSTRUCT 1

Expand Down
17 changes: 2 additions & 15 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,6 @@ esac
AC_SEARCH_LIBS(clock_gettime, rt)
AC_SEARCH_LIBS(pthread_create, pthread)

AS_IF([test -f $srcdir/libkqueue/configure.ac],
[AC_DEFINE(BUILD_OWN_KQUEUES, 1, [Define if building libkqueue from source])
ac_configure_args="--disable-libkqueue-install $ac_configure_args"
AC_CONFIG_SUBDIRS([libkqueue])
build_own_kqueues=true],
[build_own_kqueues=false
AC_CHECK_HEADER(sys/event.h, [],
[PKG_CHECK_MODULES(KQUEUE, libkqueue)]
)
]
)
AM_CONDITIONAL(BUILD_OWN_KQUEUES, $build_own_kqueues)

AC_CHECK_FUNCS([strlcpy getprogname], [],
[PKG_CHECK_MODULES(BSD_OVERLAY, libbsd-overlay,[
AC_DEFINE(HAVE_STRLCPY, 1, [])
Expand Down Expand Up @@ -423,15 +410,15 @@ AC_CHECK_FUNCS([mach_port_construct])
#
# Find functions and declarations we care about.
#
AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC], [], [],
AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC, CLOCK_REALTIME, CLOCK_UPTIME_FAST], [], [],
[[#include <time.h>]])
AC_CHECK_DECLS([NOTE_NONE, NOTE_REAP, NOTE_REVOKE, NOTE_SIGNAL, NOTE_LOWAT], [], [],
[[#include <sys/event.h>]])
AC_CHECK_DECLS([FD_COPY], [], [], [[#include <sys/select.h>]])
AC_CHECK_DECLS([SIGEMT], [], [], [[#include <signal.h>]])
AC_CHECK_DECLS([VQ_UPDATE, VQ_VERYLOWDISK, VQ_QUOTA], [], [], [[#include <sys/mount.h>]])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])
AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time malloc_create_zone sysconf])
AC_CHECK_FUNCS([pthread_key_init_np pthread_main_np mach_absolute_time mach_approximate_time malloc_create_zone sysconf])

AC_CHECK_DECLS([POSIX_SPAWN_START_SUSPENDED],
[have_posix_spawn_start_suspended=true], [have_posix_spawn_start_suspended=false],
Expand Down
4 changes: 1 addition & 3 deletions dispatch/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,8 @@
#endif

#if __has_feature(enumerator_attributes)
#define DISPATCH_ENUM_AVAILABLE_STARTING __OSX_AVAILABLE_STARTING
#define DISPATCH_ENUM_AVAILABLE(os, version) __##os##_AVAILABLE(version)
#define DISPATCH_ENUM_AVAILABLE(...) API_AVAILABLE(__VA_ARGS__)
#else
#define DISPATCH_ENUM_AVAILABLE_STARTING(...)
#define DISPATCH_ENUM_AVAILABLE(...)
#endif

Expand Down
26 changes: 13 additions & 13 deletions dispatch/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ __BEGIN_DECLS
*/
DISPATCH_ENUM(dispatch_block_flags, unsigned long,
DISPATCH_BLOCK_BARRIER
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x1,
DISPATCH_ENUM_AVAILABLE(macos(10.10), ios(8.0)) = 0x1,
DISPATCH_BLOCK_DETACHED
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x2,
DISPATCH_ENUM_AVAILABLE(macos(10.10), ios(8.0)) = 0x2,
DISPATCH_BLOCK_ASSIGN_CURRENT
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x4,
DISPATCH_ENUM_AVAILABLE(macos(10.10), ios(8.0)) = 0x4,
DISPATCH_BLOCK_NO_QOS_CLASS
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x8,
DISPATCH_ENUM_AVAILABLE(macos(10.10), ios(8.0)) = 0x8,
DISPATCH_BLOCK_INHERIT_QOS_CLASS
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x10,
DISPATCH_ENUM_AVAILABLE(macos(10.10), ios(8.0)) = 0x10,
DISPATCH_BLOCK_ENFORCE_QOS_CLASS
DISPATCH_ENUM_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0) = 0x20,
DISPATCH_ENUM_AVAILABLE(macos(10.10), ios(8.0)) = 0x20,
);

/*!
Expand Down Expand Up @@ -164,7 +164,7 @@ DISPATCH_ENUM(dispatch_block_flags, unsigned long,
* When not building with Objective-C ARC, must be released with a -[release]
* message or the Block_release() function.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_RETURNS_RETAINED_BLOCK
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_block_t
Expand Down Expand Up @@ -236,7 +236,7 @@ dispatch_block_create(dispatch_block_flags_t flags, dispatch_block_t block);
* When not building with Objective-C ARC, must be released with a -[release]
* message or the Block_release() function.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL4 DISPATCH_RETURNS_RETAINED_BLOCK
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_block_t
Expand Down Expand Up @@ -269,7 +269,7 @@ dispatch_block_create_with_qos_class(dispatch_block_flags_t flags,
* @param block
* The block to create the temporary block object from.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL2 DISPATCH_NOTHROW
void
dispatch_block_perform(dispatch_block_flags_t flags,
Expand Down Expand Up @@ -320,7 +320,7 @@ dispatch_block_perform(dispatch_block_flags_t flags,
* Returns zero on success (the dispatch block object completed within the
* specified timeout) or non-zero on error (i.e. timed out).
*/
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NOTHROW
long
dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
Expand Down Expand Up @@ -361,7 +361,7 @@ dispatch_block_wait(dispatch_block_t block, dispatch_time_t timeout);
* @param notification_block
* The notification block to submit when the observed block object completes.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue,
Expand Down Expand Up @@ -393,7 +393,7 @@ dispatch_block_notify(dispatch_block_t block, dispatch_queue_t queue,
* The result of passing NULL or a block object not returned by one of the
* dispatch_block_create* functions is undefined.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_block_cancel(dispatch_block_t block);
Expand All @@ -412,7 +412,7 @@ dispatch_block_cancel(dispatch_block_t block);
* @result
* Non-zero if canceled and zero if not canceled.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_8_0)
API_AVAILABLE(macos(10.10), ios(8.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_WARN_RESULT DISPATCH_PURE
DISPATCH_NOTHROW
long
Expand Down
20 changes: 10 additions & 10 deletions dispatch/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DISPATCH_DATA_DECL(dispatch_data);
*/
#define dispatch_data_empty \
DISPATCH_GLOBAL_OBJECT(dispatch_data_t, _dispatch_data_empty)
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT struct dispatch_data_s _dispatch_data_empty;

/*!
Expand Down Expand Up @@ -83,7 +83,7 @@ DISPATCH_EXPORT struct dispatch_data_s _dispatch_data_empty;
* was allocated by the malloc() family and should be destroyed with free(3).
*/
#define DISPATCH_DATA_DESTRUCTOR_FREE (_dispatch_data_destructor_free)
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free);

/*!
Expand All @@ -92,7 +92,7 @@ DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(free);
* from buffers that require deallocation with munmap(2).
*/
#define DISPATCH_DATA_DESTRUCTOR_MUNMAP (_dispatch_data_destructor_munmap)
__OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0)
API_AVAILABLE(macos(10.9), ios(7.0))
DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap);

#ifdef __BLOCKS__
Expand All @@ -117,7 +117,7 @@ DISPATCH_DATA_DESTRUCTOR_TYPE_DECL(munmap);
* is no longer needed.
* @result A newly created dispatch data object.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
dispatch_data_create(const void *buffer,
Expand All @@ -134,7 +134,7 @@ dispatch_data_create(const void *buffer,
* @param data The dispatch data object to query.
* @result The number of bytes represented by the data object.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_PURE DISPATCH_NONNULL1 DISPATCH_NOTHROW
size_t
dispatch_data_get_size(dispatch_data_t data);
Expand All @@ -158,7 +158,7 @@ dispatch_data_get_size(dispatch_data_t data);
* size of the mapped contiguous memory region, or NULL.
* @result A newly created dispatch data object.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
Expand All @@ -181,7 +181,7 @@ dispatch_data_create_map(dispatch_data_t data,
* @result A newly created object representing the concatenation of the
* data1 and data2 objects.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
Expand All @@ -202,7 +202,7 @@ dispatch_data_create_concat(dispatch_data_t data1, dispatch_data_t data2);
* @result A newly created object representing the specified
* subrange of the data object.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
Expand Down Expand Up @@ -247,7 +247,7 @@ typedef bool (^dispatch_data_applier_t)(dispatch_data_t region,
* @result A Boolean indicating whether traversal completed
* successfully.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
bool
dispatch_data_apply(dispatch_data_t data, dispatch_data_applier_t applier);
Expand All @@ -267,7 +267,7 @@ dispatch_data_apply(dispatch_data_t data, dispatch_data_applier_t applier);
* start of the queried data object.
* @result A newly created dispatch data object.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0)
API_AVAILABLE(macos(10.7), ios(5.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL3 DISPATCH_RETURNS_RETAINED
DISPATCH_WARN_RESULT DISPATCH_NOTHROW
dispatch_data_t
Expand Down
23 changes: 9 additions & 14 deletions dispatch/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,14 @@
#ifdef __APPLE__
#include <Availability.h>
#include <TargetConditionals.h>
#else
#define __OSX_AVAILABLE_STARTING(x, y)
#define __OSX_AVAILABLE_BUT_DEPRECATED(...)
#define __OSX_AVAILABLE_BUT_DEPRECATED_MSG(...)
#define __OSX_AVAILABLE(...)
#define __IOS_AVAILABLE(...)
#define __TVOS_AVAILABLE(...)
#define __WATCHOS_AVAILABLE(...)
#define __OSX_DEPRECATED(...)
#define __IOS_DEPRECATED(...)
#define __TVOS_DEPRECATED(...)
#define __WATCHOS_DEPRECATED(...)
#endif // __APPLE__
#endif

#ifndef API_AVAILABLE
#define API_AVAILABLE(...)
#define API_DEPRECATED(...)
#define API_UNAVAILABLE(...)
#define API_DEPRECATED_WITH_REPLACEMENT(...)
#endif // !API_AVAILABLE

#include <sys/cdefs.h>
#include <sys/types.h>
Expand All @@ -55,7 +50,7 @@
#endif
#endif

#define DISPATCH_API_VERSION 20160712
#define DISPATCH_API_VERSION 20160831

#ifndef __DISPATCH_BUILDING_DISPATCH__

Expand Down
16 changes: 8 additions & 8 deletions dispatch/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ __BEGIN_DECLS
* @result
* The newly created group, or NULL on failure.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_MALLOC DISPATCH_RETURNS_RETAINED DISPATCH_WARN_RESULT
DISPATCH_NOTHROW
dispatch_group_t
Expand Down Expand Up @@ -81,7 +81,7 @@ dispatch_group_create(void);
* The block to perform asynchronously.
*/
#ifdef __BLOCKS__
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_group_async(dispatch_group_t group,
Expand Down Expand Up @@ -115,7 +115,7 @@ dispatch_group_async(dispatch_group_t group,
* parameter passed to this function is the context provided to
* dispatch_group_async_f().
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4
DISPATCH_NOTHROW
void
Expand Down Expand Up @@ -158,7 +158,7 @@ dispatch_group_async_f(dispatch_group_t group,
* Returns zero on success (all blocks associated with the group completed
* within the specified timeout) or non-zero on error (i.e. timed out).
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
long
dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout);
Expand Down Expand Up @@ -194,7 +194,7 @@ dispatch_group_wait(dispatch_group_t group, dispatch_time_t timeout);
* The block to submit when the group completes.
*/
#ifdef __BLOCKS__
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_group_notify(dispatch_group_t group,
Expand Down Expand Up @@ -224,7 +224,7 @@ dispatch_group_notify(dispatch_group_t group,
* parameter passed to this function is the context provided to
* dispatch_group_notify_f().
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL1 DISPATCH_NONNULL2 DISPATCH_NONNULL4
DISPATCH_NOTHROW
void
Expand All @@ -248,7 +248,7 @@ dispatch_group_notify_f(dispatch_group_t group,
* The dispatch group to update.
* The result of passing NULL in this parameter is undefined.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_group_enter(dispatch_group_t group);
Expand All @@ -267,7 +267,7 @@ dispatch_group_enter(dispatch_group_t group);
* The dispatch group to update.
* The result of passing NULL in this parameter is undefined.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
API_AVAILABLE(macos(10.6), ios(4.0))
DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
void
dispatch_group_leave(dispatch_group_t group);
Expand Down
Loading

0 comments on commit ff7dc5b

Please sign in to comment.