mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Add Clear() to MessageBuffer
This commit is contained in:
parent
782791b013
commit
cf97c1f60b
|
|
@ -8,6 +8,7 @@ namespace advss {
|
|||
template<class T> class MessageBuffer {
|
||||
public:
|
||||
bool Empty();
|
||||
void Clear();
|
||||
void AppendMessage(const T &);
|
||||
std::optional<T> ConsumeMessage();
|
||||
|
||||
|
|
@ -22,6 +23,12 @@ template<class T> inline bool MessageBuffer<T>::Empty()
|
|||
return _buffer.empty();
|
||||
}
|
||||
|
||||
template<class T> inline void MessageBuffer<T>::Clear()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
_buffer.clear();
|
||||
}
|
||||
|
||||
template<class T> inline void MessageBuffer<T>::AppendMessage(const T &message)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user