summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/watchdog.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/watchdog.h')
-rw-r--r--src/osd/watchdog.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/osd/watchdog.h b/src/osd/watchdog.h
new file mode 100644
index 00000000000..f9c06e72bb0
--- /dev/null
+++ b/src/osd/watchdog.h
@@ -0,0 +1,36 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert, R. Belmont
+#ifndef _watchdog_h_
+#define _watchdog_h_
+//============================================================
+//
+// watchdog.h - watchdog handling
+//
+// SDLMAME by Olivier Galibert and R. Belmont
+//
+//============================================================
+
+#include "osdsync.h"
+#include <atomic>
+#include <thread>
+
+class watchdog
+{
+public:
+ watchdog(void);
+ ~watchdog(void);
+
+ void reset() { m_event.set(); }
+
+ osd_event & event(void) { return m_event; }
+ INT32 do_exit(void) { return m_do_exit; }
+ osd_ticks_t getTimeout(void) { return m_timeout; }
+ void setTimeout(int timeout);
+private:
+ osd_event m_event;
+ std::thread* m_thread;
+ std::atomic<INT32> m_do_exit;
+
+ osd_ticks_t m_timeout;
+};
+#endif