libdispatch vs glib

Hi all,
Following is a comparison between libdispatch and glib, just for interest.

First, libdispatch is the user space part of apple's GDC(Grand Central Dispatch), resides at There is also an introduction at

At first glimpse, libdispatch provides three different types of dispatch queues:
  1. Main queue: equivalent of glib's main event loop
  2. Global queue: backed up by a thread pool. All the jobs sent to this queue, will be executed in arbitrary threads asynchronously.
  3. Private queue: jobs in this queue will be executed serially.
Both private queue and main queue are just threads in global queue. It should be more user-friendly than combining GMainLoop and GThreadPool, e.g. process GSource in another thread (i.e using thread pool in the callback of that GSource).

The private queue can be considered as a pipeline (imaging GstPipeline in gstreamer).

libdispatch also has a type of dispatch_source_t, equivalent of GSource, but the callback is running in global queue, (hence, a different thread)

libdispatch is built on an extension to C (blocks), which is like GClosure.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]