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

Create a new process group on startup to allow safe shutdown when used with Ctrl-C console applications #262

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions aws/kinesis/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,14 @@ void set_core_limit() {
#endif
}

void create_process_group() {
#if !BOOST_OS_WINDOWS
if (setpgid(0, 0) != 0) {
LOG(error) << "Could not create a new process group";
}
#endif
}

std::string get_ca_path() {
std::string p = ".";
if (!options.ca_path.empty()) {
Expand Down Expand Up @@ -372,6 +380,8 @@ int main(int argc, char* const* argv) {
set_core_limit();
}

create_process_group()

aws::utils::set_log_level(config->log_level());

auto executor = get_executor();
Expand Down