Search code examples
windowsmultithreadingportabilitygrand-central-dispatchlibdispatch

Could Grand Central Dispatch (`libdispatch`) ever be made available on Windows?


I’m looking into multithreading, and GCD seems like a much better option than manually writing a solution using pthread.h and pthreads-win32. However, although it looks like libdispatch is either working on, or soon going to be working on, most newer POSIX-compatible systems… I have to ask, what about Windows? What are the chances of libdispatch being ported to Windows? What are the barriers preventing that from happening?

If it came down to it, what would I need to do to preform that portage?

Edit: Some things I already know, to get the discussion started:

  • We need a blocks-compatible compiler that will compile on Windows, no? Will PLBlocks handle that?
  • Can we use the LLVM blocks runtime?
  • Can’t we replace all the pthread.h dependencies in userspace libdispatch with APR calls, for portability? Or, alternatively, use pthreads-win32 I suppose…

Edit 1: I am hearing that this is completely and totally impossible, ever, because libdispatch depends (somehow) on kqueue, which can’t be made available on Windows… does anybody know if this is true?


Solution

  • Take a look at : http://opensource.mlba-team.de/xdispatch/ This project (and other third-party libs) brings libdispatch into platforms(windows, linux) other than macosx