python - Multiprocessing: main programm stops until process is finished -
i know, minimal working example gold standard , working on it. however, maybe there obvious error. function run_worker
executed upon button press event. initiates class instance , should start method of class. function run_worker waits until class method has finished. result kivy gets stuck , cannot other stuff. ideas how should use multiprocessing in case ?
from multiprocessing import process class settingsapp(app): """ short not working version of actual programm """ def build(self): """some kivy specific settings""" return interface """this part not work expected. run pushing button. however, function hang until process has finished (or has been killed).""" def run_worker(self): """the phbot application started second process. otherwise kivy blocked until function stops (which controlled close button) """ # arguments in appropriate form args = self.get_stored_settings() # initiate class should run separate process bot = phbot(*args) # control method runs devices, listens sensors etc. phbot = process(target=bot.ph_control(), args=(bot,)) # start process phbot.start() # statement executed after phbot has stopped. print('started')
i suggest study daemon processes here: https://pypi.python.org/pypi/python-daemon/
Comments
Post a Comment