1 Grand Central Dispatch (GCD)
3 GCD is a concurrent programming framework first shipped with Mac OS X Snow
4 Leopard. This package is an open source bundling of libdispatch, the core
5 user space library implementing GCD. At the time of writing, support for
6 the BSD kqueue API, and specifically extensions introduced in Mac OS X Snow
7 Leopard and FreeBSD 9-CURRENT, are required to use libdispatch. Other
8 systems are currently unsupported.
10 Configuring and installing libdispatch
12 GCD is built using autoconf, automake, and libtool, and has a number of
13 compile-time configuration options that should be reviewed before starting.
14 An uncustomized install requires:
20 The following configure options may be of general interest:
22 --with-apple-libc-source
24 Specify the path to Apple's Libc package, so that appropriate headers
25 can be found and used.
27 --with-apple-xnu-source
29 Specify the path to Apple's XNU package, so that appropriate headers
30 can be found and used.
34 On systems where -fblocks is supported, specify an additional library
35 path in which libBlocksRuntime can be found. This is not required on
36 Mac OS X, where the Blocks runtime is included in libSystem, but is
39 Some sites will wish to build using a non-default C compiler; for example,
40 this is desirable on FreeBSD so that libdispatch is built with clang and
41 blocks support. A typically FreeBSD configuration will use:
43 CC=clang ./configure --with-blocks-runtime=/usr/local/lib
47 The following options are likely only to be required if building libdispatch
48 as part of Mac OS X's libSystem:
52 Enable a legacy (deprecated) API used by some early GCD applications.
54 --disable-libdispatch-init-constructor
56 Do not tag libdispatch's init routine as __constructor, in which case
57 it must be run manually before libdispatch routines can be called.
58 For the libdispatch code compiled directly into libSystem, the init
59 routine is called automatically during process start.
61 --enable-apple-crashreporter-info
63 Set global variables during a libdispatch crash to provide additional
64 debugging information for CrashReporter.
66 --enable-apple-tsd-optimizations
68 Use a non-portable allocation scheme for pthread per-thread data
69 (TSD) keys when built into libSystem on Mac OS X. This should not be
70 used on other OS's, nor on Mac OS X when building as a stand-alone
73 --enable-apple-semaphore-optimizations
75 libdispatch contains hand-optimized assembly for use with libdispatch
78 Typical configuration commands
80 The following command lines create the default config.h required to build
81 libdispatch with libSystem in Mac OS X Snow Leopard:
85 --with-apple-libc-source=/path/to/10.6.0/Libc-583 \
86 --with-apple-xnu-source=/path/to/10.6.0/xnu-1456.1.26 \
88 --disable-libdispatch-init-constructor \
89 --enable-apple-crashreporter-info \
90 --enable-apple-tsd-optimizations \
91 --enable-apple-semaphore-optimizations
93 Typical configuration line for FreeBSD 8.x and 9.x:
96 CC=clang ./configure --with-blocks-runtime=/usr/local/lib