2013-03-26 09:27:52 +08:00
|
|
|
//===--- Unix/Watchdog.inc - Unix Watchdog Implementation -------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-03-26 09:27:52 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file provides the generic Unix implementation of the Watchdog class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2018-04-30 22:59:11 +08:00
|
|
|
#include "llvm/Config/config.h"
|
|
|
|
|
2013-03-26 09:27:52 +08:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
namespace sys {
|
|
|
|
Watchdog::Watchdog(unsigned int seconds) {
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
alarm(seconds);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
Watchdog::~Watchdog() {
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
alarm(0);
|
|
|
|
#endif
|
|
|
|
}
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
|
|
|
}
|