Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement runAsync (wait for thread) #27

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

mildred
Copy link
Contributor

@mildred mildred commented Apr 12, 2023

Fixes #26

Implementation requires threading and the http server runs always in a background thread, main thread returns a future that completes when the background thread terminates.

@@ -567,6 +570,9 @@ proc eventLoop(params: (OnRequest, Settings)) =
processEvents(selector, events, ret, onRequest)
asyncdispatch.poll(0)

if threadVars.event.isSome():
threadVars.event.get().trigger()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be an unsafeGet.

Copy link
Owner

@ringabout ringabout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It would be nice to have a simple documentation or example here or in the Prologue for its usage.

@ringabout ringabout merged commit c338072 into ringabout:master Apr 17, 2023
@mildred mildred deleted the feat-run-async branch April 18, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multiple servers running in parallel async
2 participants