| Nick Lewycky | 4e06def | 2013-03-26 01:27:52 +0000 | [diff] [blame] | 1 | //===--- 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 |  | 
|  | 14 | #ifdef HAVE_UNISTD_H | 
|  | 15 | #include <unistd.h> | 
|  | 16 | #endif | 
|  | 17 |  | 
|  | 18 | namespace llvm { | 
|  | 19 | namespace sys { | 
|  | 20 | Watchdog::Watchdog(unsigned int seconds) { | 
|  | 21 | #ifdef HAVE_UNISTD_H | 
|  | 22 | alarm(seconds); | 
|  | 23 | #endif | 
|  | 24 | } | 
|  | 25 |  | 
|  | 26 | Watchdog::~Watchdog() { | 
|  | 27 | #ifdef HAVE_UNISTD_H | 
|  | 28 | alarm(0); | 
|  | 29 | #endif | 
|  | 30 | } | 
| Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 31 | } | 
|  | 32 | } |