Last active
February 16, 2026 15:37
-
-
Save johnslavik/77e689c043276612d2e9286df318243c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import os | |
| async def task_inner(): | |
| with open("/dev/urandom", "rb") as urandom: | |
| feed = await asyncio.to_thread(urandom.read, 128) | |
| print(feed[:16].hex(), "\r", end="") | |
| async def task(): | |
| async with asyncio.TaskGroup() as tg: | |
| tg.create_task(task_inner()) | |
| async def main(): | |
| while True: | |
| await task() | |
| if __name__ == "__main__": | |
| print(f"PID: {os.getpid()}") | |
| asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment