From d139217ed53516bfcb71de171bf209706f5c842a Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 11 Dec 2016 14:05:38 +0100 Subject: Extract term event polling --- src/util/term.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/util/term.cc b/src/util/term.cc index 9e4c101..704f872 100644 --- a/src/util/term.cc +++ b/src/util/term.cc @@ -1,5 +1,7 @@ #include "term.h" +#include + #include namespace util { @@ -27,4 +29,14 @@ TermGuard::~TermGuard() { tb_shutdown(); } +tb_event TermGuard::poll() const { + struct tb_event event; + + if ( tb_poll_event(&event) == -1 ) { + throw std::system_error(); + } else { + return event; + } +} + } -- cgit v1.2.3