LLVM API Documentation

Unix/Watchdog.inc
Go to the documentation of this file.
00001 //===--- Unix/Watchdog.inc - Unix Watchdog Implementation -------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file provides the generic Unix implementation of the Watchdog class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifdef HAVE_UNISTD_H
00015 #include <unistd.h>
00016 #endif
00017 
00018 namespace llvm {
00019   namespace sys {
00020     Watchdog::Watchdog(unsigned int seconds) {
00021 #ifdef HAVE_UNISTD_H
00022       alarm(seconds);
00023 #endif
00024     }
00025 
00026     Watchdog::~Watchdog() {
00027 #ifdef HAVE_UNISTD_H
00028       alarm(0);
00029 #endif
00030     }
00031   }
00032 }