summaryrefslogtreecommitdiff
path: root/t/threads.py
diff options
context:
space:
mode:
Diffstat (limited to 't/threads.py')
-rw-r--r--t/threads.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/threads.py b/t/threads.py
new file mode 100644
index 0000000..fa9c7ac
--- /dev/null
+++ b/t/threads.py
@@ -0,0 +1,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()