Watchdog.inc 778 B

1234567891011121314151617181920212223242526272829303132
  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. #ifdef HAVE_UNISTD_H
  14. #include <unistd.h>
  15. #endif
  16. namespace llvm {
  17. namespace sys {
  18. Watchdog::Watchdog(unsigned int seconds) {
  19. #ifdef HAVE_UNISTD_H
  20. alarm(seconds);
  21. #endif
  22. }
  23. Watchdog::~Watchdog() {
  24. #ifdef HAVE_UNISTD_H
  25. alarm(0);
  26. #endif
  27. }
  28. }
  29. }