|
@@ -32,10 +32,28 @@ async def cpu_bound_work() -> int:
|
|
|
# Так делать нет никакого смысла
|
|
|
@async_timed()
|
|
|
async def main():
|
|
|
+
|
|
|
+ sleep_for_three = asyncio.create_task(delay(3))
|
|
|
+ sleep_again = asyncio.create_task(delay(3))
|
|
|
+ sleep_once_more = asyncio.create_task(delay(3))
|
|
|
+
|
|
|
+ await sleep_for_three
|
|
|
+ await sleep_again
|
|
|
+ await sleep_once_more
|
|
|
+
|
|
|
+
|
|
|
+ """
|
|
|
+ task_one = asyncio.create_task(cpu_bound_work())
|
|
|
+ print(type(task_one))
|
|
|
+ result = await task_one
|
|
|
+ print(result)
|
|
|
+ """
|
|
|
+
|
|
|
+ """
|
|
|
task_one = asyncio.create_task(cpu_bound_work())
|
|
|
task_two = asyncio.create_task(cpu_bound_work())
|
|
|
await task_one
|
|
|
await task_two
|
|
|
-
|
|
|
+ """
|
|
|
|
|
|
asyncio.run(main())
|