libdispatch vs glib
- From: cee1 <fykcee1 gmail com>
- To: gtk-devel-list gnome org
- Subject: libdispatch vs glib
- Date: Wed, 16 Sep 2009 16:08:42 +0800
Hi all,
Following is a comparison between libdispatch and glib, just for interest.
At first glimpse, libdispatch provides three different types of dispatch queues:
- Main queue: equivalent of glib's main event loop
- Global queue: backed up by a thread pool. All the jobs sent to this queue, will be executed in arbitrary threads asynchronously.
- 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]