Make a hard reset of named barrier mutexes on signal
This commit is contained in:
parent
bc081b7132
commit
76de3b6ace
@ -1,3 +1,4 @@
|
|||||||
|
#include "storage/shared_barriers.hpp"
|
||||||
#include "storage/storage.hpp"
|
#include "storage/storage.hpp"
|
||||||
#include "util/exception.hpp"
|
#include "util/exception.hpp"
|
||||||
#include "util/log.hpp"
|
#include "util/log.hpp"
|
||||||
@ -7,6 +8,9 @@
|
|||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
|
#include <csignal>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
|
|
||||||
// generate boost::program_options object for the routing part
|
// generate boost::program_options object for the routing part
|
||||||
@ -87,8 +91,20 @@ bool generateDataStoreOptions(const int argc,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[ noreturn ]] void CleanupSharedBarriers(int signum)
|
||||||
|
{ // Here the lock state of named mutexes is unknown, make a hard cleanup
|
||||||
|
osrm::storage::SharedBarriers::resetCurrentRegions();
|
||||||
|
std::_Exit(128 + signum);
|
||||||
|
}
|
||||||
|
|
||||||
int main(const int argc, const char *argv[]) try
|
int main(const int argc, const char *argv[]) try
|
||||||
{
|
{
|
||||||
|
int signals[] = {SIGTERM, SIGSEGV, SIGINT, SIGILL, SIGABRT, SIGFPE};
|
||||||
|
for (auto sig : signals)
|
||||||
|
{
|
||||||
|
std::signal(sig, CleanupSharedBarriers);
|
||||||
|
}
|
||||||
|
|
||||||
util::LogPolicy::GetInstance().Unmute();
|
util::LogPolicy::GetInstance().Unmute();
|
||||||
|
|
||||||
boost::filesystem::path base_path;
|
boost::filesystem::path base_path;
|
||||||
|
Loading…
Reference in New Issue
Block a user