开发者

Using grand central dispatch in Linux

开发者 https://www.devze.com 2023-01-05 09:02 出处:网络
Is this possible, since Apple has open sourced the code (libdispatch?) I\'m bit confused as to how one can make use of this. Is this like a library with an API that any application can make use of, or

Is this possible, since Apple has open sourced the code (libdispatch?) I'm bit confused as to how one can make use of this. Is this like a library with an API that any application can make use of, or an OS feature built into Mac OS X? Can application built "for" Macs and iPhone (with iOS 4) alone make use of this library?

I assume one has to run a port to make gcc also compat开发者_开发技巧ible with the new semantic that Apple has introduced.


It's almost a year later but I'm using it quite happily on Ubuntu Natty. Proper packages are coming in Oneiric.


Having read the Ars Technica overview, it appears there are several challenges

  • GCD makes extensive use of blocks (an Apple extension to C that approximates closures) which means your compiler needs to support blocks. The standard version of gcc has no support for blocks, so you'll either have to port Apple's changes to the Linux gcc or use clang/llvm.
  • The Mac OS X version of GCD involves some code in the kernel. Clearly, if kernel changes are required to Linux to support GCD, that is a major piece of work. However, it seems that a user space only port is possible.
  • GCD is licensed under the Apache License. Apparently, this license is not compatible with GPL v2. So you cannot use GCD in any app distributed under GPL v2. GPL v3 is OK though, so an app licensed under GPL v2 "or later" is OK.

Having said all that, the FreeBSD port has been done, so it must be possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消