本文整理汇总了C++中Daemon::delete_lock方法的典型用法代码示例。如果您正苦于以下问题:C++ Daemon::delete_lock方法的具体用法?C++ Daemon::delete_lock怎么用?C++ Daemon::delete_lock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Daemon
的用法示例。
在下文中一共展示了Daemon::delete_lock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
::signal(SIGTERM, SIG_DFL);
::signal(SIGINT, SIG_DFL);
::signal(SIGILL, SIG_DFL);
::signal(SIGIOT, SIG_DFL);
::signal(SIGBUS, SIG_DFL);
::signal(SIGFPE, SIG_DFL);
::signal(SIGSEGV, SIG_DFL);
::signal(SIGSTKFLT, SIG_DFL);
daemon.unblock_signals();
if (!nodaemon) {
if (!daemon.lock()) {
log(name() + " already running: exit");
closelog();
return 1;
}
daemon.write_pid();
}
}
catch (std::exception& e) {
die = true;
log(e.what(), LOG_CRIT);
closelog();
return 1;
}
try {
daemon.go_home();
// Harden our umask so that the new socket gets created
// securely.
umask(0077);
// Register to the milter interface.
socket(sockarg);
debug(debuglvl);
if (initialize<Undervest>() != MI_SUCCESS) {
log("Cannot initialize milter interface", LOG_CRIT);
closelog();
return 1;
}
// If we need to set the uid/gid/jail, do it now.
daemon.incarcerate();
daemon.change_identity();
// Start the scheduler.
schedThread = std::thread(&Scheduler::run, std::ref(sched));
// Read configuration file and domain data.
reload();
if (&(*conf) == NULL) {
sched.stop();
return 1;
}
// Start a thread to monitor and process our signals.
// Note: Signals SIGTERM, SIGHUP and SIGABRT are processed
// by the milter library.
sigThread = std::thread(&Globals::reloader, std::ref(*this));
// Enter the milter service loop.
if (start(static_cast<void *>(this)) == MI_FAILURE)
throw std::runtime_error("Cannot run the milter");
}
catch (std::exception& e) {
die = true;
sched.stop();
log(e.what(), LOG_CRIT);
if (!nodaemon) {
daemon.delete_pid();
daemon.delete_lock();
}
closelog();
return 1;
}
die = true;
sched.stop();
if (!nodaemon) {
daemon.delete_pid();
daemon.delete_lock();
}
closelog();
return 0;
}