Dev HelpersOpen library
← Back

Use an async queue

Use an async queue. A self-contained example using the Python standard library.

Open this example in the interactive library

Source code

import asyncio
async def main():
    queue = asyncio.Queue()
    await queue.put('job')
    value = await queue.get()
    queue.task_done()
    await queue.join()
    return value
print(asyncio.run(main()))

Sample output

job