Main event loop in networkmanager.
- From: Anders Gnistrup <agn datarespons dk>
- To: "networkmanager-list gnome org" <networkmanager-list gnome org>
- Subject: Main event loop in networkmanager.
- Date: Wed, 3 Aug 2011 09:54:18 +0200
Hi
FIrst post to this maillist.
My problem is that I need to receive signal from the networkmanager.
This is done using connect_to_signal and it seems quite easy.
But when testing I get the error message -> create a glib event loop.
And thats My problem. I already have a loop.
The short description of my application is a interface able to configure some wireless network interfaces from a remote host using a XMLrpc from twisted. (There is no screen on target platform)
the application loop is a XMLrpc interface (reactor), where several rpc is available. Some of these graps information from the networkmanager dbus interface. This is OK, because it is a synchronous API. But when adding a new connection (using addConnection), the succes/fail is a signal (networkmanager version 0.84). So I need to create a asynchronous loop. (I know this is changed in networkmanager version 0.9)
So I have two solutions:
1) Tell the networkmanger signal to use my loop. (seems impossible, if please tell me how)
2) Create a second thread and start a loop using:
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
additional code ......
loop = gobject.MainLoop()
loop.run
The second solution creates new problems. I need to make data thread safe, and there is no need for two thread. It's only signals!
I have searched the net for a solution for (1), but I can't find any
(2) is possible but does not seems "right"
Regards Anders Gnsitrup
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]