Watchdog.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- Watchdog.h - Watchdog timer ----------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file declares the llvm::sys::Watchdog class.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_SUPPORT_WATCHDOG_H
  18. #define LLVM_SUPPORT_WATCHDOG_H
  19. #include "llvm/Support/Compiler.h"
  20. namespace llvm {
  21. namespace sys {
  22. /// This class provides an abstraction for a timeout around an operation
  23. /// that must complete in a given amount of time. Failure to complete before
  24. /// the timeout is an unrecoverable situation and no mechanisms to attempt
  25. /// to handle it are provided.
  26. class Watchdog {
  27. public:
  28. Watchdog(unsigned int seconds);
  29. ~Watchdog();
  30. private:
  31. // Noncopyable.
  32. Watchdog(const Watchdog &other) = delete;
  33. Watchdog &operator=(const Watchdog &other) = delete;
  34. };
  35. }
  36. }
  37. #endif
  38. #ifdef __GNUC__
  39. #pragma GCC diagnostic pop
  40. #endif