blob: f4253391d95281b2079860a80749780d9088e545 [file] [log] [blame]
Nick Lewycky4e06def2013-03-26 01:27:52 +00001//===--- Unix/Watchdog.inc - Unix Watchdog Implementation -------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file provides the generic Unix implementation of the Watchdog class.
11//
12//===----------------------------------------------------------------------===//
13
Nico Weber432a3882018-04-30 14:59:11 +000014#include "llvm/Config/config.h"
15
Nick Lewycky4e06def2013-03-26 01:27:52 +000016#ifdef HAVE_UNISTD_H
17#include <unistd.h>
18#endif
19
20namespace llvm {
21 namespace sys {
22 Watchdog::Watchdog(unsigned int seconds) {
23#ifdef HAVE_UNISTD_H
24 alarm(seconds);
25#endif
26 }
27
28 Watchdog::~Watchdog() {
29#ifdef HAVE_UNISTD_H
30 alarm(0);
31#endif
32 }
Alexander Kornienkof00654e2015-06-23 09:49:53 +000033 }
34}