summaryrefslogtreecommitdiff
path: root/t/threads.py
blob: fa9c7ace3f5a0904c2c2db4e926beb9c98d8ef2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import asyncio
import threading



async def count():
    print("it's a secret!")
    await asyncio.sleep(3)


async def main():
    await asyncio.gather(count(), count(), count())
    print("done")


def thread_func():
    asyncio.run(main())


if __name__ == "__main__":
    x = threading.Thread(target=thread_func)
    x.start()
    x.join()