ubus loop blocks all threads
I am developing a multi threaded application, I was launching 4 parallel threads without issues but when I added an ubus object all the application is blocked (with exception of the ubus loop). I launch this:
ubus_service_thread = threading.Thread(target=ubus_service, args=(Controller,))
Unix_Receiver_thread = threading.Thread(target=ct_cmdu_receiver, args=(Controller, ieee1905_port, controller_port_access, rec_to_send, rec_to_coord,log_fname,))
Unix_Sender_thread = threading.Thread(target=ct_cmdu_sender, args=(ieee1905_port, controller_port_access, rec_to_send, coord_to_send, algorithm_to_send,log_fname,))
Coordinator_thread = threading.Thread(target=controller_coordinator, args=(rec_to_coord, coord_to_send, coord_to_algorithm, Controller,log_fname,))
Algorithm_thread = threading.Thread(target=controller_algorithm, args=(algorithm_to_send, Controller,log_fname,))
threads = []
threads.append(ubus_service_thread)
threads.append(Unix_Receiver_thread)
threads.append(Unix_Sender_thread)
threads.append(Coordinator_thread)
threads.append(Algorithm_thread)
for thread in threads:
thread.start()
The ubus thread is just:
def ubus_service(Controller):
Controller.ubus_init() # adds an object
ubus.loop()
Also I find that "ubus.connect" is global (goes over "ubus" module, not a class from which one can create multiple instances). This seems to be a problem, for example I have two threads which some of them can be the one who attends the calls, and another one which does calls and listens to events from other ubus objects (of other applications)... so I will be launching two ubus.loop() reffering to the same connection... this could be a problem? If it is, can I create two different connections?
Thanks in advance.
Pablo.