Created
March 26, 2020 13:43
-
-
Save alehander92/09d1698dd615794f0450e3cdaa9fb8c1 to your computer and use it in GitHub Desktop.
This file contains 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
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