equal
deleted
inserted
replaced
433 def evaluator(tocall, *args, **kwargs): |
433 def evaluator(tocall, *args, **kwargs): |
434 # To prevent deadlocks, check if current thread is not one of the UI |
434 # To prevent deadlocks, check if current thread is not one of the UI |
435 # UI threads can be either the one from WX main loop or |
435 # UI threads can be either the one from WX main loop or |
436 # worker thread from twisted "threadselect" reactor |
436 # worker thread from twisted "threadselect" reactor |
437 current_id = currentThread().ident |
437 current_id = currentThread().ident |
|
438 |
438 if ui_thread is not None \ |
439 if ui_thread is not None \ |
439 and ui_thread.ident != current_id \ |
440 and ui_thread.ident != current_id \ |
440 and (not havetwisted or ( |
441 and (not havetwisted or ( |
441 twisted_reactor_thread_id is not None |
442 twisted_reactor_thread_id is not None |
442 and twisted_reactor_thread_id != current_id)): |
443 and twisted_reactor_thread_id != current_id)): |
568 ui_thread.start() |
569 ui_thread.start() |
569 |
570 |
570 # This order ui loop to unblock main thread when ready. |
571 # This order ui loop to unblock main thread when ready. |
571 if havetwisted: |
572 if havetwisted: |
572 def signal_uithread_started(): |
573 def signal_uithread_started(): |
|
574 global twisted_reactor_thread_id |
573 twisted_reactor_thread_id = currentThread().ident |
575 twisted_reactor_thread_id = currentThread().ident |
574 ui_thread_started.release() |
576 ui_thread_started.release() |
575 reactor.callLater(0, signal_uithread_started) |
577 reactor.callLater(0, signal_uithread_started) |
576 else: |
578 else: |
577 wx.CallAfter(ui_thread_started.release) |
579 wx.CallAfter(ui_thread_started.release) |