threads for GMainLoop

Sven Herzberg herzi-ml at gnome-de.org
Wed Oct 1 04:48:14 PDT 2008


Am Dienstag, den 30.09.2008, 23:24 -0700 schrieb knightmanish:
> I'm using DBus with the dbus-glib integration. I am trying to implement
> threads at server side (service side). Presently, the gmain loop calls the
> designated method whenever it receives a message. I was wondering is there
> any way to call that particular method in separate thread and receive the
> messages in separate thread?? 

In each thread, you can have a main context with a main loop. Then you
can easily add tasks by inserting eg. a g_timout_source_new() into the
context of a specified thread by calling g_source_attach() with the
appropriate context.

http://github.com/herzi/hauptbahnhof/tree/master/queue.c
^^ look at queue_job() and execute_job()

Regards,
  Sven



More information about the dbus mailing list