在一个thread里放io loop,单独启动一个Server或者Client没问题,
但是,如果我要在一个thread里放io loop,并启动一个Server,然后在一个Button注册一个事件,开一个线程去调用一个coroutine是不行的,出现错误:
AssertionError: There is no current event loop in thread 'Thread-3'.
类似这样:
```
def hello():
def _x():
@
asyncio.coroutine
def echo():
words = 'hello'
reader, writer = yield from asyncio.open_connection('localhost', 8888)
writer.write(words.encode('utf-8'))
answer = yield from reader.readline()
print(answer.decode('utf-8'))
writer.close()
loop = asyncio.new_event_loop()
loop.run_until_complete(echo())
loop.close()
threading.Thread(target=_x).start()
```