Ejemplo n.º 1
0
void sighandler_func(int signal)
{
	IBRCOMMON_LOGGER_TAG(TAG,notice) << "got signal " << signal << IBRCOMMON_LOGGER_ENDL;
	switch (signal)
	{
	case SIGTERM:
	case SIGINT:
	{
		//stop waiting and stop running, on SIGINT or SIGTERM
		ibrcommon::MutexLock l(_wait_cond);
		_running = false;
		_wait_cond.signal(true);
		break;
	}
#ifndef __WIN32__
	case SIGUSR1:
	{
		//stop waiting on SIGUSR1 -> "quickscan"
		ibrcommon::MutexLock l(_wait_cond);
		_wait_abort = true;
		_wait_cond.signal(true);
		break;
	}
#endif
	default:
		break;
	}
}
Ejemplo n.º 2
0
// on interruption do this!
void sighandler(int signal)
{
	// do not handle further signals if the shutdown is in progress
	if (_shutdown) return;

	switch (signal)
	{
	case SIGTERM:
	case SIGINT:
	{
		ibrcommon::MutexLock l(_shutdown_cond);
		_shutdown = true;
		_shutdown_cond.signal(true);
		break;
	}

	case SIGUSR1:
		if (!_debug)
		{
			ibrcommon::Logger::addStream(std::cout, ibrcommon::Logger::LOGGER_DEBUG, logopts);
			_debug = true;
		}

		_dtnd.setDebug(99);
		break;
	case SIGUSR2:
		_dtnd.setDebug(0);
		break;
	case SIGHUP:
		_dtnd.reload();
		break;
	default:
		// dummy handler
		break;
	}
}