Skip to content

Commit

Permalink
PySC2: Import of refs/pull/17/head
Browse files Browse the repository at this point in the history
Move UI rendering to main thread for OSX compatibility

PiperOrigin-RevId: 164995195
  • Loading branch information
Tomasz Kowal authored and tewalds committed Aug 11, 2017
1 parent 43a23ed commit 509f607
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pysc2/bin/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,13 @@ def _main(unused_argv):
agent_cls = getattr(importlib.import_module(agent_module), agent_name)

threads = []
for i in range(FLAGS.parallel):
t = threading.Thread(target=run_thread, args=(
agent_cls, FLAGS.map, FLAGS.render and i == 0))
for _ in range(FLAGS.parallel - 1):
t = threading.Thread(target=run_thread, args=(agent_cls, FLAGS.map, False))
threads.append(t)
t.start()

run_thread(agent_cls, FLAGS.map, FLAGS.render)

for t in threads:
t.join()

Expand Down

0 comments on commit 509f607

Please sign in to comment.