picloud add "-w" option for watchdog
This commit is contained in:
@@ -45,6 +45,7 @@ void DispatcherServer::picoutStatus() {
|
||||
|
||||
|
||||
void DispatcherServer::cleanClients() {
|
||||
wd_cnt++;
|
||||
PIMutexLocker locker(map_mutex);
|
||||
for (auto s: rmrf_servers)
|
||||
s->close();
|
||||
@@ -194,6 +195,23 @@ void DispatcherServer::setMaxConnections(uint max_count) {
|
||||
}
|
||||
|
||||
|
||||
void DispatcherServer::startWatchdog() {
|
||||
wd_cnt++;
|
||||
PIThread * thread = new PIThread(
|
||||
[this]() {
|
||||
if (wd_cnt == 0) {
|
||||
piCout << "Deadlock detected, abort";
|
||||
std::abort();
|
||||
return;
|
||||
}
|
||||
wd_cnt = 0;
|
||||
},
|
||||
true,
|
||||
10_s);
|
||||
NO_UNUSED(thread);
|
||||
}
|
||||
|
||||
|
||||
void DispatcherServer::disconnectClient(DispatcherClient * client) {
|
||||
PIMutexLocker locker(map_mutex);
|
||||
if (!clients.contains(client)) {
|
||||
|
||||
Reference in New Issue
Block a user