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

fix multi ctrlc handlers set in win. #323

Closed
wants to merge 1 commit into from

Conversation

canxin121
Copy link

close #322

@canxin121 canxin121 closed this Mar 29, 2024
use std::{cell::RefCell, thread};

use ntex_rt::System;

use crate::server::Server;

static CTRL_C_HANDLER_SET: AtomicBool = AtomicBool::new(false);
Copy link
Member

Choose a reason for hiding this comment

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

could you mark it with #[cfg(target_family = "windows")]

Copy link
Author

Choose a reason for hiding this comment

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

I found this fix can't stop the ntex-server normally. I need some time to find a other way. And I will add #[cfg(target_family = "windows")]

Copy link
Member

Choose a reason for hiding this comment

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

you should store System in global before checking for var and use it instead of System::current()

Copy link
Author

Choose a reason for hiding this comment

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

you should store System in global before checking for var and use it instead of System::current()

I'm not very good at reading all this complex runtime management code, I'm afraid I need someone who knows more about ntex to fix this problem 😳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[ntex-server](Bug) Duplicates ctrlc_handler registration under win causing process crash
2 participants