Skip to content

Revert "Merge darwin/libdispatch-890 to master" #255

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
Jun 2, 2017
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
12 changes: 12 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ Specify the path to Apple's libpthread package, so that appropriate headers
Specify the path to Apple's libplatform package, so that appropriate headers
can be found and used.

`--with-apple-libclosure-source`

Specify the path to Apple's Libclosure package, so that appropriate headers
can be found and used.

`--with-apple-xnu-source`

Specify the path to Apple's XNU package, so that appropriate headers can be
Expand All @@ -99,6 +104,11 @@ On systems where -fblocks is supported, specify an additional library path in wh
The following options are likely to only be useful when building libdispatch on
OS X as a replacement for /usr/lib/system/libdispatch.dylib:

`--with-apple-objc4-source`

Specify the path to Apple's objc4 package, so that appropriate headers can
be found and used.

`--disable-libdispatch-init-constructor`

Do not tag libdispatch's init routine as __constructor, in which case it must be run manually before libdispatch routines can be called. This is the default when building on OS X. For /usr/lib/system/libdispatch.dylib the init routine is called automatically during process start.
Expand All @@ -121,7 +131,9 @@ libdispatch for /usr/lib/system on OS X El Capitan:
--enable-apple-tsd-optimizations \
--with-apple-libpthread-source=/path/to/10.11.0/libpthread-137.1.1 \
--with-apple-libplatform-source=/path/to/10.11.0/libplatform-73.1.1 \
--with-apple-libclosure-source=/path/to/10.11.0/libclosure-65 \
--with-apple-xnu-source=/path/to/10.11.0/xnu-3247.1.106 \
--with-apple-objc4-source=/path/to/10.11.0/objc4-680
make check

### Building and installing for FreeBSD
Expand Down
28 changes: 27 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ AC_ARG_WITH([apple-libplatform-source],
CPPFLAGS="$CPPFLAGS -isystem $apple_libplatform_source_include_path"
])

AC_ARG_WITH([apple-libclosure-source],
[AS_HELP_STRING([--with-apple-libclosure-source],
[Specify path to Apple libclosure source])], [
apple_libclosure_source_path=${withval}
CPPFLAGS="$CPPFLAGS -isystem $apple_libclosure_source_path"
])

AC_ARG_WITH([apple-xnu-source],
[AS_HELP_STRING([--with-apple-xnu-source],
[Specify path to Apple XNU source])], [
Expand All @@ -136,6 +143,12 @@ AC_ARG_WITH([apple-xnu-source],
CPPFLAGS="$CPPFLAGS -idirafter $apple_xnu_source_libkern_path -isystem $apple_xnu_source_bsd_path -isystem $apple_xnu_source_libsyscall_path -isystem $apple_xnu_source_libproc_path "
])

AC_ARG_WITH([apple-objc4-source],
[AS_HELP_STRING([--with-apple-objc4-source],
[Specify path to Apple objc4 source])], [
apple_objc4_source_runtime_path=${withval}/runtime
])

AC_CACHE_CHECK([for System.framework/PrivateHeaders], dispatch_cv_system_privateheaders,
[AS_IF([test -d /System/Library/Frameworks/System.framework/PrivateHeaders],
[dispatch_cv_system_privateheaders=yes], [dispatch_cv_system_privateheaders=no])]
Expand Down Expand Up @@ -374,11 +387,24 @@ AC_CHECK_HEADER([Foundation/Foundation.h],
[have_foundation=true], [have_foundation=false]
)
AM_CONDITIONAL(HAVE_FOUNDATION, $have_foundation)
AC_CHECK_HEADER([objc/runtime.h], [
# hack for objc4/runtime/objc-internal.h
AS_IF([test -n "$apple_objc4_source_runtime_path"], [
saveCPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I."
ln -fsh "$apple_objc4_source_runtime_path" objc
])
AC_CHECK_HEADER([objc/objc-internal.h], [
AC_DEFINE(HAVE_OBJC, 1, [Define if you have the Objective-C runtime])
have_objc=true], [have_objc=false],
[#include <objc/runtime.h>]
)
AS_IF([test -n "$apple_objc4_source_runtime_path"], [
rm -f objc
CPPFLAGS="$saveCPPFLAGS"
AC_CONFIG_COMMANDS([src/objc],
[ln -fsh "$apple_objc4_source_runtime_path" src/objc],
[apple_objc4_source_runtime_path="$apple_objc4_source_runtime_path"])
])
AM_CONDITIONAL(USE_OBJC, $have_objc)
AC_LANG_POP([Objective C])

Expand Down
3 changes: 1 addition & 2 deletions dispatch/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#ifdef __APPLE__
#include <Availability.h>
#include <os/availability.h>
#include <TargetConditionals.h>
#include <os/base.h>
#elif defined(__linux__)
Expand All @@ -48,7 +47,7 @@
#endif
#endif

#define DISPATCH_API_VERSION 20170124
#define DISPATCH_API_VERSION 20160831

#ifndef __DISPATCH_BUILDING_DISPATCH__

Expand Down
54 changes: 9 additions & 45 deletions dispatch/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,49 +206,15 @@ dispatch_sync_f(dispatch_queue_t queue,
void *_Nullable context,
dispatch_function_t work);


#if !defined(__APPLE__) || TARGET_OS_WATCH || TARGET_OS_TV || \
(defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \
__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0) || \
(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9)
#define DISPATCH_APPLY_AUTO_AVAILABLE 1
#else
#define DISPATCH_APPLY_AUTO_AVAILABLE 0
#endif

/*!
* @constant DISPATCH_APPLY_AUTO
*
* @abstract
* Constant to pass to dispatch_apply() or dispatch_apply_f() to request that
* the system automatically use worker threads that match the configuration of
* the current thread most closely.
*
* @discussion
* When submitting a block for parallel invocation, passing this constant as the
* queue argument will automatically use the global concurrent queue that
* matches the Quality of Service of the caller most closely.
*
* No assumptions should be made about which global concurrent queue will
* actually be used.
*
* Using this constant deploys backward to macOS 10.9, iOS 7.0 and any tvOS or
* watchOS version.
*/
#if DISPATCH_APPLY_AUTO_AVAILABLE
#define DISPATCH_APPLY_AUTO ((dispatch_queue_t _Nonnull)0)
#endif

/*!
* @function dispatch_apply
*
* @abstract
* Submits a block to a dispatch queue for parallel invocation.
* Submits a block to a dispatch queue for multiple invocations.
*
* @discussion
* Submits a block to a dispatch queue for parallel invocation. This function
* waits for the task block to complete before returning. If the specified queue
* Submits a block to a dispatch queue for multiple invocations. This function
* waits for the task block to complete before returning. If the target queue
* is concurrent, the block may be invoked concurrently, and it must therefore
* be reentrant safe.
*
Expand All @@ -258,9 +224,8 @@ dispatch_sync_f(dispatch_queue_t queue,
* The number of iterations to perform.
*
* @param queue
* The dispatch queue to which the block is submitted.
* The preferred value to pass is DISPATCH_APPLY_AUTO to automatically use
* a queue appropriate for the calling thread.
* The target dispatch queue to which the block is submitted.
* The result of passing NULL in this parameter is undefined.
*
* @param block
* The block to be invoked the specified number of iterations.
Expand All @@ -278,7 +243,7 @@ dispatch_apply(size_t iterations, dispatch_queue_t queue,
* @function dispatch_apply_f
*
* @abstract
* Submits a function to a dispatch queue for parallel invocation.
* Submits a function to a dispatch queue for multiple invocations.
*
* @discussion
* See dispatch_apply() for details.
Expand All @@ -287,15 +252,14 @@ dispatch_apply(size_t iterations, dispatch_queue_t queue,
* The number of iterations to perform.
*
* @param queue
* The dispatch queue to which the function is submitted.
* The preferred value to pass is DISPATCH_APPLY_AUTO to automatically use
* a queue appropriate for the calling thread.
* The target dispatch queue to which the function is submitted.
* The result of passing NULL in this parameter is undefined.
*
* @param context
* The application-defined context parameter to pass to the function.
*
* @param work
* The application-defined function to invoke on the specified queue. The first
* The application-defined function to invoke on the target queue. The first
* parameter passed to this function is the context provided to
* dispatch_apply_f(). The second parameter passed to this function is the
* current index of iteration.
Expand Down
Loading