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

Graceful termination of Rocket application #776

Closed
antekone opened this issue Sep 18, 2018 · 2 comments
Closed

Graceful termination of Rocket application #776

antekone opened this issue Sep 18, 2018 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@antekone
Copy link

antekone commented Sep 18, 2018

I'm using Rocket 0.3.16.

Is there a way to make Rocket break its main loop and quit the application gracefully?

I'm trying to convert my Rocket application to a Windows Service. A Windows Service apparently needs Rocket application to be spawned in a different thread, and reserve its main thread to receive/process Windows Service events. To properly handle the Stop signal, the main application should terminate the Rocket thread gracefully, so I can't simply use std::process:exit().

I couldn't find any mention of how to quit the Rocket app. The documentation only says that the Rocket::launch() function never returns, so this might be unsupported?

Currently I'm using conditional compilation on Windows; I'm importing kernel32 crate, and I'm performing an unsafe call to TerminateThread. It's nowhere near the proper solution and I'd like to change it.

@antekone antekone changed the title Clean termination of Rocket application Graceful termination of Rocket application Sep 18, 2018
@jebrosen
Copy link
Collaborator

Clean shutdown is desired at some point (see #180). Today, though, I think non-graceful termination through TerminateThread or spawning a Rocket server in a child process to kill later is the only working solution.

@SergioBenitez SergioBenitez added the duplicate This issue or pull request already exists label Sep 19, 2018
@SergioBenitez
Copy link
Member

Closing as a duplicate of #180.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants