os: Add Input::Event_queue::reset function

Resetting the input-event queue is useful for error handling.

Issue #1185
This commit is contained in:
Norman Feske 2014-06-11 20:24:25 +02:00
parent bb83c0d3da
commit b6f8bcca6a
2 changed files with 7 additions and 0 deletions

View File

@ -78,6 +78,8 @@ class Input::Event_queue
bool empty() const { return _queue.empty(); }
int avail_capacity() const { return _queue.avail_capacity(); }
void reset() { _queue.reset(); }
};
#endif /* _EVENT_QUEUE_H_ */

View File

@ -132,6 +132,11 @@ class Ring_buffer
else
return _tail - _head - 1;
}
/**
* Discard all ring-buffer elements
*/
void reset() { _head = _tail; }
};
#endif /* _INCLUDE__OS__RING_BUFFER_H_ */