Re: libdispatch vs glib
- From: Christian Hergert <chris dronelabs com>
- To: cee1 <fykcee1 gmail com>
- Cc: gtk-devel-list gnome org
- Subject: Re: libdispatch vs glib
- Date: Wed, 16 Sep 2009 01:28:11 -0700
Hi,
Have you see my library iris[1]?
It includes a lot of the same sort of stuff (albeit not nearly the
attention and optimization yet) and includes:
* a work-stealing scheduler thats 8x faster than GThreadPool
on my local machines (dual and quad-cores)
* message-passing using ports/receivers
* a dynamic scheduler manager that can scale threads as neaded
and tear them back down. applications can have multiple schedulers
based on what they want if needed.
* reusable lock-free data structures such as Queue, FreeList, Stack,
and Round-Robin.
* IrisTask which is like Twisted's Deferred for addCallback/addErrback
type functionality.
* iris_arbiter_coordinate() which is a reader/writer lock implemented
asynchronously using message passing (on top of ports/receivers)
* bindings for python, vala, and gobject-introspection (vala might be
out of date though).
* GMainLoop integration for scheduling callbacks in the mainloop.
One major thing it lacks
* eyes looking at the code
* documentation
But best of all, its written fully using GLib :-)
I wrote this during my spring/summer after I quit my job. However I
start a new one in a few weeks but would love some input from others and
ideally more people to commit features and generally use it.
Cheers,
-- Christian
[1] http://git.dronelabs.com/iris
cee1 wrote:
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 http://libdispatch.macosforge.org. There is also
an introduction at
http://developer.apple.com/mac/articles/cocoa/introblocksgcd.html.
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.
------------------------------------------------------------------------
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]