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

bin: handle TERM/INT signal #1058

Merged
merged 4 commits into from Sep 12, 2016
Merged

bin: handle TERM/INT signal #1058

merged 4 commits into from Sep 12, 2016

Conversation

BusyJay
Copy link
Member

@BusyJay BusyJay commented Sep 12, 2016

ref: #1053

break;
}
// TODO: handle more signal
_ => debug!("ignore signal: {}", sig),
Copy link
Member

Choose a reason for hiding this comment

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

s/debug/warn/

@BusyJay BusyJay changed the title bin: handle TERM/INT signal [DNM] bin: handle TERM/INT signal Sep 12, 2016
@BusyJay BusyJay changed the title [DNM] bin: handle TERM/INT signal bin: handle TERM/INT signal Sep 12, 2016
fn handle_signal(ch: SendCh<Msg>) {
use signal::trap::Trap;
use nix::sys::signal::{SIGTERM, SIGINT};
let trap = Trap::trap(&[SIGTERM, SIGINT]);
Copy link
Contributor

Choose a reason for hiding this comment

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

it will block until receiving a signal?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the for loop below will block.

Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't find any doc or example how trap should be used.
Will it rerun this piece of signal catching code if the specified signal happens? Like a callback.

Copy link
Member Author

Choose a reason for hiding this comment

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

@siddontang
Copy link
Contributor

LGTM
We can use this in #1042 too.

@BusyJay
Copy link
Member Author

BusyJay commented Sep 12, 2016

PTAL

@hhkbp2
Copy link
Contributor

hhkbp2 commented Sep 12, 2016

LGTM

@BusyJay BusyJay merged commit 3c8c40d into master Sep 12, 2016
@BusyJay BusyJay deleted the busyjay/handle-signal branch September 12, 2016 12:50
iosmanthus pushed a commit to iosmanthus/tikv that referenced this pull request Oct 30, 2023
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.

None yet

4 participants