Skip to content

Commit f583d54

Browse files
authored
Merge pull request #255 from apple/revert-254-das-darwin-libdispatch-890-merge-master
Revert "Merge darwin/libdispatch-890 to master"
2 parents 22df1e7 + 6ebe8e9 commit f583d54

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3369
-4191
lines changed

INSTALL.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ Specify the path to Apple's libpthread package, so that appropriate headers
8787
Specify the path to Apple's libplatform package, so that appropriate headers
8888
can be found and used.
8989
90+
`--with-apple-libclosure-source`
91+
92+
Specify the path to Apple's Libclosure package, so that appropriate headers
93+
can be found and used.
94+
9095
`--with-apple-xnu-source`
9196
9297
Specify the path to Apple's XNU package, so that appropriate headers can be
@@ -99,6 +104,11 @@ On systems where -fblocks is supported, specify an additional library path in wh
99104
The following options are likely to only be useful when building libdispatch on
100105
OS X as a replacement for /usr/lib/system/libdispatch.dylib:
101106
107+
`--with-apple-objc4-source`
108+
109+
Specify the path to Apple's objc4 package, so that appropriate headers can
110+
be found and used.
111+
102112
`--disable-libdispatch-init-constructor`
103113
104114
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.
@@ -121,7 +131,9 @@ libdispatch for /usr/lib/system on OS X El Capitan:
121131
--enable-apple-tsd-optimizations \
122132
--with-apple-libpthread-source=/path/to/10.11.0/libpthread-137.1.1 \
123133
--with-apple-libplatform-source=/path/to/10.11.0/libplatform-73.1.1 \
134+
--with-apple-libclosure-source=/path/to/10.11.0/libclosure-65 \
124135
--with-apple-xnu-source=/path/to/10.11.0/xnu-3247.1.106 \
136+
--with-apple-objc4-source=/path/to/10.11.0/objc4-680
125137
make check
126138
127139
### Building and installing for FreeBSD

configure.ac

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ AC_ARG_WITH([apple-libplatform-source],
125125
CPPFLAGS="$CPPFLAGS -isystem $apple_libplatform_source_include_path"
126126
])
127127

128+
AC_ARG_WITH([apple-libclosure-source],
129+
[AS_HELP_STRING([--with-apple-libclosure-source],
130+
[Specify path to Apple libclosure source])], [
131+
apple_libclosure_source_path=${withval}
132+
CPPFLAGS="$CPPFLAGS -isystem $apple_libclosure_source_path"
133+
])
134+
128135
AC_ARG_WITH([apple-xnu-source],
129136
[AS_HELP_STRING([--with-apple-xnu-source],
130137
[Specify path to Apple XNU source])], [
@@ -136,6 +143,12 @@ AC_ARG_WITH([apple-xnu-source],
136143
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 "
137144
])
138145

146+
AC_ARG_WITH([apple-objc4-source],
147+
[AS_HELP_STRING([--with-apple-objc4-source],
148+
[Specify path to Apple objc4 source])], [
149+
apple_objc4_source_runtime_path=${withval}/runtime
150+
])
151+
139152
AC_CACHE_CHECK([for System.framework/PrivateHeaders], dispatch_cv_system_privateheaders,
140153
[AS_IF([test -d /System/Library/Frameworks/System.framework/PrivateHeaders],
141154
[dispatch_cv_system_privateheaders=yes], [dispatch_cv_system_privateheaders=no])]
@@ -374,11 +387,24 @@ AC_CHECK_HEADER([Foundation/Foundation.h],
374387
[have_foundation=true], [have_foundation=false]
375388
)
376389
AM_CONDITIONAL(HAVE_FOUNDATION, $have_foundation)
377-
AC_CHECK_HEADER([objc/runtime.h], [
390+
# hack for objc4/runtime/objc-internal.h
391+
AS_IF([test -n "$apple_objc4_source_runtime_path"], [
392+
saveCPPFLAGS="$CPPFLAGS"
393+
CPPFLAGS="$CPPFLAGS -I."
394+
ln -fsh "$apple_objc4_source_runtime_path" objc
395+
])
396+
AC_CHECK_HEADER([objc/objc-internal.h], [
378397
AC_DEFINE(HAVE_OBJC, 1, [Define if you have the Objective-C runtime])
379398
have_objc=true], [have_objc=false],
380399
[#include <objc/runtime.h>]
381400
)
401+
AS_IF([test -n "$apple_objc4_source_runtime_path"], [
402+
rm -f objc
403+
CPPFLAGS="$saveCPPFLAGS"
404+
AC_CONFIG_COMMANDS([src/objc],
405+
[ln -fsh "$apple_objc4_source_runtime_path" src/objc],
406+
[apple_objc4_source_runtime_path="$apple_objc4_source_runtime_path"])
407+
])
382408
AM_CONDITIONAL(USE_OBJC, $have_objc)
383409
AC_LANG_POP([Objective C])
384410

dispatch/dispatch.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#ifdef __APPLE__
2525
#include <Availability.h>
26-
#include <os/availability.h>
2726
#include <TargetConditionals.h>
2827
#include <os/base.h>
2928
#elif defined(__linux__)
@@ -48,7 +47,7 @@
4847
#endif
4948
#endif
5049

51-
#define DISPATCH_API_VERSION 20170124
50+
#define DISPATCH_API_VERSION 20160831
5251

5352
#ifndef __DISPATCH_BUILDING_DISPATCH__
5453

dispatch/queue.h

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -206,49 +206,15 @@ dispatch_sync_f(dispatch_queue_t queue,
206206
void *_Nullable context,
207207
dispatch_function_t work);
208208

209-
210-
#if !defined(__APPLE__) || TARGET_OS_WATCH || TARGET_OS_TV || \
211-
(defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \
212-
__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0) || \
213-
(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
214-
__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_9)
215-
#define DISPATCH_APPLY_AUTO_AVAILABLE 1
216-
#else
217-
#define DISPATCH_APPLY_AUTO_AVAILABLE 0
218-
#endif
219-
220-
/*!
221-
* @constant DISPATCH_APPLY_AUTO
222-
*
223-
* @abstract
224-
* Constant to pass to dispatch_apply() or dispatch_apply_f() to request that
225-
* the system automatically use worker threads that match the configuration of
226-
* the current thread most closely.
227-
*
228-
* @discussion
229-
* When submitting a block for parallel invocation, passing this constant as the
230-
* queue argument will automatically use the global concurrent queue that
231-
* matches the Quality of Service of the caller most closely.
232-
*
233-
* No assumptions should be made about which global concurrent queue will
234-
* actually be used.
235-
*
236-
* Using this constant deploys backward to macOS 10.9, iOS 7.0 and any tvOS or
237-
* watchOS version.
238-
*/
239-
#if DISPATCH_APPLY_AUTO_AVAILABLE
240-
#define DISPATCH_APPLY_AUTO ((dispatch_queue_t _Nonnull)0)
241-
#endif
242-
243209
/*!
244210
* @function dispatch_apply
245211
*
246212
* @abstract
247-
* Submits a block to a dispatch queue for parallel invocation.
213+
* Submits a block to a dispatch queue for multiple invocations.
248214
*
249215
* @discussion
250-
* Submits a block to a dispatch queue for parallel invocation. This function
251-
* waits for the task block to complete before returning. If the specified queue
216+
* Submits a block to a dispatch queue for multiple invocations. This function
217+
* waits for the task block to complete before returning. If the target queue
252218
* is concurrent, the block may be invoked concurrently, and it must therefore
253219
* be reentrant safe.
254220
*
@@ -258,9 +224,8 @@ dispatch_sync_f(dispatch_queue_t queue,
258224
* The number of iterations to perform.
259225
*
260226
* @param queue
261-
* The dispatch queue to which the block is submitted.
262-
* The preferred value to pass is DISPATCH_APPLY_AUTO to automatically use
263-
* a queue appropriate for the calling thread.
227+
* The target dispatch queue to which the block is submitted.
228+
* The result of passing NULL in this parameter is undefined.
264229
*
265230
* @param block
266231
* The block to be invoked the specified number of iterations.
@@ -278,7 +243,7 @@ dispatch_apply(size_t iterations, dispatch_queue_t queue,
278243
* @function dispatch_apply_f
279244
*
280245
* @abstract
281-
* Submits a function to a dispatch queue for parallel invocation.
246+
* Submits a function to a dispatch queue for multiple invocations.
282247
*
283248
* @discussion
284249
* See dispatch_apply() for details.
@@ -287,15 +252,14 @@ dispatch_apply(size_t iterations, dispatch_queue_t queue,
287252
* The number of iterations to perform.
288253
*
289254
* @param queue
290-
* The dispatch queue to which the function is submitted.
291-
* The preferred value to pass is DISPATCH_APPLY_AUTO to automatically use
292-
* a queue appropriate for the calling thread.
255+
* The target dispatch queue to which the function is submitted.
256+
* The result of passing NULL in this parameter is undefined.
293257
*
294258
* @param context
295259
* The application-defined context parameter to pass to the function.
296260
*
297261
* @param work
298-
* The application-defined function to invoke on the specified queue. The first
262+
* The application-defined function to invoke on the target queue. The first
299263
* parameter passed to this function is the context provided to
300264
* dispatch_apply_f(). The second parameter passed to this function is the
301265
* current index of iteration.

0 commit comments

Comments
 (0)