Hi
I have a problem, which I can not solve. I have an application, which have a
XML interface (based on twisted.web import xmlrpc)
I have a snippet of code that is be called via the xmlrpc interface.
def ssidList(self):
def ssid_blocking():
wlan_list = []
for apDict in self.wifi.GetAccessPointsInfo():
if apDict['Ssid'] != None:
val = apDict['Ssid']
str_val = ""
for elt in val:
# This test should not be needed, but prevents crashes.
if type(elt) == type(dbus.Byte(1)):
str_val += chr(elt)
wlan_list.append({ 'ssid' : str_val } )
return wlan_list;
# return ssid_blocking()
d = threads.deferToThread(ssid_blocking)
def retResult(var):
return var
d.addCallback(retResult)
return d
If I remove the # before "# return ssid_blocking()" everything works just fine
(no use of deferToThread). If I try to use the defreToThread method, the
program crashes. The problem seems to be related to the usage of
DBusGMainLoop(set_as_default=True).
My theory is that when entering a deferToThread a new thread is created, but
the dbus mainloop lives in another thread.
The call that makes the program crashes is when calling bus.get_object (bus is
a dbus.SystemBus())
My goal is to create a nonblocking xmlrpc interface.
Can anyone give an explanation, or describe a alternative solution.
/AG
_______________________________________________
networkmanager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list