LibreOffice Module vcl (master)  1
watchdog.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #ifndef INCLUDED_VCL_INC_OPENGL_WATCHDOG_H
11 #define INCLUDED_VCL_INC_OPENGL_WATCHDOG_H
12 
13 #include <sal/config.h>
14 #include <salhelper/thread.hxx>
15 #include <atomic>
16 #include <vector>
17 
19 {
22  int const mnAbortAfter;
23 };
24 
26 {
27  NORMAL,
29 };
30 
32 {
33 private:
34  std::vector<WatchdogTimingsValues> maTimingValues;
35  std::atomic<bool> mbRelaxed;
36 
37 public:
39 
40  void setRelax(bool bRelaxed)
41  {
42  mbRelaxed = bRelaxed;
43  }
44 
46  {
47  size_t index = (eMode == WatchdogTimingMode::SHADER_COMPILE) ? 1 : 0;
48  index = mbRelaxed ? index + 2 : index;
49 
50  return maTimingValues[index];
51  }
52 };
53 
55 {
57  virtual void execute() override;
58 public:
61  static void start();
62  static void stop();
63 };
64 
65 #endif // INCLUDED_VCL_INC_OPENGL_WATCHDOG_H
66 
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::atomic< bool > mbRelaxed
Definition: watchdog.hxx:35
int mnDisableEntries
delays to take various actions in 1/4 of a second increments.
Definition: watchdog.hxx:21
WatchdogTimingMode
Definition: watchdog.hxx:25
int const mnAbortAfter
Definition: watchdog.hxx:22
virtual void execute() override
WatchdogTimingsValues const & getWatchdogTimingsValues(WatchdogTimingMode eMode)
Definition: watchdog.hxx:45
tuple index
std::vector< WatchdogTimingsValues > maTimingValues
Definition: watchdog.hxx:34
void setRelax(bool bRelaxed)
Definition: watchdog.hxx:40