Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 869
ELLIOTTCABLE Avatar asked May 02 '10 02:05

ELLIOTTCABLE


People also ask

What is Grand Central Dispatch iOS?

Grand Central Dispatch is used in iOS to introduce concurrency and parallelism in the iOS applications, so that multiple heavy tasks are performed in the background, resulting in the smooth experience of the application usage, as the main thread is unaffected by the heavy background tasks.

What is Lib dispatch?

Grand Central Dispatch (GCD or libdispatch), is a technology developed by Apple Inc. to optimize application support for systems with multi-core processors and other symmetric multiprocessing systems. It is an implementation of task parallelism based on the thread pool pattern.

How does Grand Central Dispatch work?

GCD is built on top of threads. Under the hood, it manages a shared thread pool. With GCD, you add blocks of code or work items to dispatch queues and GCD decides which thread to execute them on. As you structure your code, you'll find code blocks that can run simultaneously and some that should not.

What is Dispatch in iOS Swift?

Dispatch, also known as Grand Central Dispatch (GCD), contains language features, runtime libraries, and system enhancements that provide systemic, comprehensive improvements to the support for concurrent code execution on multicore hardware in macOS, iOS, watchOS, and tvOS.


2 Answers

https://github.com/DrPizza/libdispatch

like image 82
DrPizza Avatar answered Oct 21 '22 10:10

DrPizza


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

like image 28
sprhawk Avatar answered Oct 21 '22 09:10

sprhawk