/home/arjun/llvm-project/llvm/lib/Support/Unix/Watchdog.inc
Line | Count | Source (jump to first uncovered line) |
1 | | //===--- Unix/Watchdog.inc - Unix Watchdog Implementation -------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file provides the generic Unix implementation of the Watchdog class. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #include "llvm/Config/config.h" |
14 | | |
15 | | #ifdef HAVE_UNISTD_H |
16 | | #include <unistd.h> |
17 | | #endif |
18 | | |
19 | | namespace llvm { |
20 | | namespace sys { |
21 | 0 | Watchdog::Watchdog(unsigned int seconds) { |
22 | 0 | #ifdef HAVE_UNISTD_H |
23 | 0 | alarm(seconds); |
24 | 0 | #endif |
25 | 0 | } |
26 | | |
27 | 0 | Watchdog::~Watchdog() { |
28 | 0 | #ifdef HAVE_UNISTD_H |
29 | 0 | alarm(0); |
30 | 0 | #endif |
31 | 0 | } |
32 | | } |
33 | | } |