Skip to content

Commit

Permalink
Fix macOS "_dispatch_main_queue_callback_4CF called from the wrong th…
Browse files Browse the repository at this point in the history
…read"

The issue is related to opening a render window and starting the interactor
on a multiprocessing Process (it worked before Sierra). We must now
avoid forking a new Process if platform is Darwin.
  • Loading branch information
lantiga committed Dec 11, 2016
1 parent 7fe8ec4 commit e83ea5e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions PypeS/pyperun.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
if __name__=='__main__':
manager = Manager()
queue = manager.list()
pypeProcess = Process(target=pypeserver.PypeServer, args=(queue,None,None), kwargs={"returnIfEmptyQueue":True})
pypeProcess.start()

if sys.platform != 'darwin':
pypeProcess = Process(target=pypeserver.PypeServer, args=(queue,None,None), kwargs={"returnIfEmptyQueue":True})
pypeProcess.start()

args = sys.argv[:]
if sys.argv[0].startswith('pyperun'):
Expand All @@ -36,9 +38,13 @@
queue.append(args)

try:
pypeProcess.join()
if sys.platform != 'darwin':
pypeProcess.join()
else:
pypeserver.PypeServer(queue,None,None,returnIfEmptyQueue=True)
except KeyboardInterrupt:
pypeProcess.terminate()
except BaseException, e:
print e
sys.exit(1)

0 comments on commit e83ea5e

Please sign in to comment.