from dbus.mainloop.glib import DBusGMainLoop
from time import sleep
import threading
import dbus, gobject
# Monitor usb on a separate thread
def monitor_usb():
DBusGMainLoop(set_as_default=True)
dbus.SystemBus() # Probably source of error
gobject.threads_init()
gobject.MainLoop().run()
thread=threading.Thread(target=monitor_usb)
thread.daemon=True
thread.start()
# Calling this while monitor_usb is running
# will cause segmentation fault
dbus.SystemBus()
sleep(10)
有没有办法解决这个问题?