Skip to content

Instantly share code, notes, and snippets.

@alehander92
Created March 26, 2020 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alehander92/09d1698dd615794f0450e3cdaa9fb8c1 to your computer and use it in GitHub Desktop.
Save alehander92/09d1698dd615794f0450e3cdaa9fb8c1 to your computer and use it in GitHub Desktop.
proc pushOrSend[Input, Output](queue: AsyncQueue[Input, Output], input: Input): Future[Output] =
var future = newFuture[Output]("pushOrSend " & $input)
queue.list.addFirst(input)
queue.futures.addFirst(future)
if not queue.running:
await queue.run()
return future
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment