| Both sides previous revision Previous revision Next revision | Previous revision |
| grandcentraldispatch [2009/11/13 12:19] – Add names of porters and a ToC. RobertWatson | grandcentraldispatch [2020/12/27 06:41] (current) – Remove 3 broken hyperlinks. SashaVigole |
|---|
| ===== Status ===== | ===== Status ===== |
| |
| GCD support is **experimental** on %%FreeBSD%% 8.x and 9.x, and requires recent versions of the ''%%llvm-devel%%'' and ''%%compiler-rt%%'' ports. The kernel extensions required to support ''%%libdispatch%%'' are now in the %%FreeBSD%% 8-STABLE branch, and will appear in %%FreeBSD%% 8.1 and later. | GCD support is considered production-worthy on %%FreeBSD%% 8.1 and later, and requires recent versions of the ''%%llvm-devel%%'' and ''%%compiler-rt%%'' ports. The kernel extensions required to support ''%%libdispatch%%'' first appeared in %%FreeBSD%% 8.1. |
| |
| ^ Branch ^ Date ^ Minimum SVN revision ^ | ^ Branch ^ Date ^ Minimum SVN revision ^ |
| | 8-STABLE | 2009-11-01 | r198732 | | | 8-STABLE | 2009-11-01 | r198732 | |
| | 9-CURRENT | 2009-09-18 | r197293 | | | 9-CURRENT | 2009-09-18 | r197293 | |
| | |
| | Experimental patches exist to add pthread workqueue support to the %%FreeBSD%% 9.x kernel, but are not present in shipped kernels (including 9-CURRENT). |
| |
| ===== Quick-start ===== | ===== Quick-start ===== |
| |
| - Install %%FreeBSD%% 8.0-RC3. | - Install %%FreeBSD%% 8.1 (or later). |
| - Perform a source upgraded to %%FreeBSD%% 8-STABLE or %%FreeBSD%% 9-CURRENT. | |
| - Update to the most recently available ports collection. | |
| - Install the ''%%devel/libdispatch%%'' port, which will install ''%%llvm-devel%%'' and ''%%compiler-rt%%'' as dependencies. | - Install the ''%%devel/libdispatch%%'' port, which will install ''%%llvm-devel%%'' and ''%%compiler-rt%%'' as dependencies. |
| |
| ''%%libdispatch%%'' works fine with ''%%gcc%%'' as shipped with %%FreeBSD%% for the function-centric interface dispatch APIs, but to use C Blocks you will need to build with ''%%clang -fblocks%%''. Currently, ''%%clang%%'' does not support C++, so you are limited to using either C++ or blocks in a single source file. | ''%%libdispatch%%'' works fine with ''%%gcc%%'' as shipped with %%FreeBSD%% for the function-centric interface dispatch APIs, but to use C Blocks you will need to build with ''%%clang -fblocks%%''. Also, ''%%llvm-gcc4%%'' (derived from Apple's gcc) and will work but is unsupported upstream. |
| | |
| | As of version 10.0, %%FreeBSD%% ships with clang and compiler_rt in the base system so GCD is available out of the box. On Tier-2 platforms, where clang is not yet shipped by default, support for blocks has been added to GCC in base. |
| |
| To build applications with ''%%libdispatch%%'', add ''%%-I/usr/local/include%%'' to compiler command lines, and ''%%-L/usr/local/lib -ldispatch%%'' to linker command lines. | To build applications with ''%%libdispatch%%'', add ''%%-I/usr/local/include%%'' to compiler command lines, and ''%%-L/usr/local/lib -ldispatch%%'' to linker command lines. |
| gcc -Wall -Werror -I/usr/local/include -L/usr/local/lib -o test2 test2.c -ldispatch | gcc -Wall -Werror -I/usr/local/include -L/usr/local/lib -o test2 test2.c -ldispatch |
| </code> | </code> |
| | |
| | ===== Experimental Patches ===== |
| | |
| | * [[https://reviews.freebsd.org/D3189|D3189]] based on Stacy Son's [[http://people.freebsd.org/~sson/thrworkq/|PThread Workqueues for FreeBSD 9.0]] |
| |
| ===== Useful references ===== | ===== Useful references ===== |
| | |
| | [[http://youtu.be/nhbA9jZyYO4|Demo with GCD in action]] |
| |
| ''%%libdispatch%%'' ships with informative man pages describing not just the API, but also how to structure programs around GCD. | ''%%libdispatch%%'' ships with informative man pages describing not just the API, but also how to structure programs around GCD. |
| [[http://libdispatch.macosforge.org/|Mac OS X Forge - open source libdispatch home]] - libdispatch subversion repository and mailing lists | [[http://libdispatch.macosforge.org/|Mac OS X Forge - open source libdispatch home]] - libdispatch subversion repository and mailing lists |
| |
| [[http://images.apple.com/macosx/technology/docs/GrandCentral_TB_brief_20090903.pdf|Grand Central Dispatch: Technology Brief]] - a white paper from Apple introducing GCD. | [[http://web.archive.org/web/20090920043909/http://images.apple.com/macosx/technology/docs/GrandCentral_TB_brief_20090903.pdf|Grand Central Dispatch: Technology Brief]] - a white paper from Apple introducing GCD. |
| | |
| | Mac OS X Reference Library: Concurrency Programming Guide - a guide to concurrent programming on Mac OS X, much of which also applies to %%FreeBSD%% with the GCD port installed. |
| |
| [[http://developer.apple.com/mac/library/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html|Mac OS X Reference Library: Concurrency Programming Guide]] - a guide to concurrent programming on Mac OS X, much of which also applies to %%FreeBSD%% with the GCD port installed. | Mac Dev Center: Grand Central Dispatch Reference - reference material on GCD from Apple. |
| |
| [[http://developer.apple.com/mac/library/documentation/Performance/Reference/GCD_libdispatch_Ref/Reference/reference.html|Mac Dev Center: Grand Central Dispatch Reference]] - reference material on GCD from Apple. | Mac OS Reference Library: Dispatch_Samples - sample code using GCD from Apple. |
| |
| [[http://developer.apple.com/mac/library/samplecode/Dispatch_Samples/|Mac OS Reference Library: Dispatch_Samples]] - sample code using GCD from Apple. | {{GrandCentralDispatch/20090918-devsummit-gcd-public.pdf?linkonly|20090918-devsummit-gcd-public.pdf}} - 2008 DevSummit Presentation |
| |