posted by Thom Holwerda on Tue 13th Oct 2009 18:24 UTC, submitted by Lazarus
IconNot too long ago, Apple open sourced its Grand Central Dispatch library, which aids in developing multithreaded code. It was suggested that it could be ported to other platforms, and the FreeBSD team has done exactly that. They have also done a lot of work related to getting GCD to work in a POSIX environment.

Apart from actually porting the Gand Central Dispatch framework, a number of other things needed to be done do adapt the library for use outside of Mac OS X:

  • Added new kqueue primitives required to support GCD, such as EVFILT_USER and EV_TRIGGER
  • Created autoconf and automake build framework for libdispatch
  • Modified libdispatch to use POSIX semaphores instead of Mach semaphores
  • Adapted libdispatch to use portable POSIX time routines

The other important aspect of getting Gand Central Dispatch to work optimally is a blocks-aware compiler. Jordan Hubbard has worked on providing a blocks-aware clang compiler package for FreeBSD. "When compiled with clang, libdispatch provides blocks-based, as well as function-based callbacks."

You can find the current port in the ports collection, but for the future, it's going to work out-of-the-box. "After FreeBSD 8.0-RELEASE has shipped, the new kqueue primitives will be MFC'd so that libdispatch works out of the box on FreeBSD 8.1-RELEASE." They are also investigating any possible benefits it might bring to modify FeeBSD base operating system tools to use GCD.

e p (20)    65 Comment(s)

Technology White Papers

See More