working of g_main_loop_run() and GThread on different platform.

Daniel P. Berrange dan at berrange.com
Thu Aug 19 04:27:50 PDT 2010


On Thu, Aug 19, 2010 at 11:04:50AM +0530, Mukesh Savaliya wrote:
> Ok,than let me put my design. Actually the code is so long that,I cant put
> it here. Still, let me go with the flow.
> 
> Please,keep in mind this code works on PC(ix86) with SUSE-11.3 installed.
> But is not working on ARM board(works only when I don't run while(1),which
> Is not possible in our design.)
> 
> Glib application.
> 
> #include <glib.h>
> #include <dbus-glib.h>
> 
> Main()
> {
>   Initdbuscom(); //establishes dbus commn,and creates Proxy
> 
>   While(1)
> 	{
> 	  Poll_1();
> 	  Poll_2();
>         Poll_qtevent_queue(); //this will read the event from queue
>          If(ANY_EVENT)
> 		{
> 		  Sendmessage("show this",1 to n);//sends string with the
> message id.
> 		}
> 	}
> }
> 
> Initdbuscomm()
> {
>  GThread *thread;
> 
>  G_type_init();
>  Create_event_queue();
>  Connection =dbus_g_bus_get(DBUS_BUSS_SESION,&err);
>  Proxy=dbus_g_proxy_new_for_name_owner(connection,servicename,pathname,
> interfacename,&err);
>  
>  InitThreading();
>   {
>  	If(!g_thread_supported())
>  	 {
> 		G_thread_init();

Shouldn't you be initializing threads earlier than this, before
creating the dbus connection / proxy objects, immediately after
the g_type_init() call. I think you also probably need to call 
dbus_g_thread_init() to initialize dbus' threading support.

/*
 * dbus_g_thread_init:
 *
 * Initializes the D-BUS thread system.
 * This function may only be called
 * once and must be called prior to calling any
 * other function in the D-BUS API.
 */

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100819/e9f71e37/attachment.pgp>


More information about the dbus mailing list