blob: c84e22b4bd06d590cf26dc4ea290e332319be1db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/******************************************************************************
* Top contributors (to current version):
* Gereon Kremer
*
* This file is part of the cvc5 project.
*
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
* in the top-level source directory and their institutional affiliations.
* All rights reserved. See the file COPYING in the top-level source
* directory for licensing information.
* ****************************************************************************
*
* Implementation of time limits that are imposed by the --tlimit option.
*/
#ifndef CVC5__MAIN__TIME_LIMIT_H
#define CVC5__MAIN__TIME_LIMIT_H
#include "options/options.h"
namespace cvc5 {
namespace main {
/**
* This class makes sure that the main thread signals back to the time
* limit mechanism when it wants to terminate. This is necessary if we
* use our custom std::thread-based timers. Following RAII, we signal
* this using a destructor so that we can never forget to abort the time
* limit thread.
*/
struct TimeLimit
{
~TimeLimit();
};
/**
* Installs an overall wall-clock time limit for the solver binary.
* It retrieves the time limit and creates a POSIX timer (via setitimer()).
* This timer signals its expiration with an SIGALRM that is handled by
* timeout_handler() in signal_handler.cpp.
* If the POSIX timers are not available (e.g., we are running on windows)
* we implement our own timer based on std::thread. In this case, the main
* thread needs to communicate back to the timer thread when it wants to
* terminate, which is done via the TimeLimit object.
*/
TimeLimit install_time_limit(const Options& opts);
} // namespace main
} // namespace cvc5
#endif /* CVC5__MAIN__TIME_LIMIT_H */
|