Exemplo n.º 1
0
/*
 * Deal with signals.
 *
 * LOCKING: acquires and releases configlock.
 */
void *
signal_thread(void *arg)
{
	int		err, signo;

	for (;;) {
		err = sigwait(&mask, &signo);
		if (err != 0)
			log_quit("sigwait failed: %s", strerror(err));
		switch (signo) {
		case SIGHUP:
			/*
			 * Schedule to re-read the configuration file.
			 */
			pthread_mutex_lock(&configlock);
			reread = 1;
			pthread_mutex_unlock(&configlock);
			break;

		case SIGTERM:
			kill_workers();
			log_msg("terminate with signal %s", strsignal(signo));
			exit(0);

		default:
			kill_workers();
			log_quit("unexpected signal %d", signo);
		}
	}
}
Exemplo n.º 2
0
static void sig_exit(int signal)
{
	kill_workers();
	if(signal == SIGINT) print_stats(opt.output);
	destroy_options(&opt);
	if(signal == SIGINT) {
		sigaction(SIGINT, &sigdfl, NULL);
		kill(getpid(), SIGINT);
	}
	exit(signal);
}
Exemplo n.º 3
0
void python_kill_workers(){
    return kill_workers();
}