You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defmain_loop(self):
whileTrue:
self.task_lock.acquire() # <-------------------------------HERE# принимаем все входящие сообщенияself.process_input()
iflen(self.tasks):
self.process_output()
else:
time.sleep(0) # аналог thread.yield() в других языкахself.task_lock.release() # <--------------------------------- AND HERE
This is because you need to be able to safely add to the list of tasks while running main_loop. I am sure that there is a more elegant solution, I just do not know about it.
The task is get rid of Lock()
The text was updated successfully, but these errors were encountered:
There is a blocking code in main_loop method:
This is because you need to be able to safely add to the list of tasks while running
main_loop
. I am sure that there is a more elegant solution, I just do not know about it.The task is get rid of
Lock()
The text was updated successfully, but these errors were encountered: