mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-22 06:03:45 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
49
drape_frontend/message_acceptor.hpp
Normal file
49
drape_frontend/message_acceptor.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "drape_frontend/message_queue.hpp"
|
||||
|
||||
#include "drape/pointers.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <functional>
|
||||
|
||||
namespace df
|
||||
{
|
||||
class Message;
|
||||
|
||||
class MessageAcceptor
|
||||
{
|
||||
protected:
|
||||
MessageAcceptor();
|
||||
virtual ~MessageAcceptor() = default;
|
||||
|
||||
virtual void AcceptMessage(ref_ptr<Message> message) = 0;
|
||||
|
||||
/// Must be called by subclass on message target thread
|
||||
bool ProcessSingleMessage(bool waitForMessage = true);
|
||||
|
||||
void CancelMessageWaiting();
|
||||
|
||||
void CloseQueue();
|
||||
|
||||
bool IsInInfinityWaiting() const;
|
||||
|
||||
#ifdef DEBUG_MESSAGE_QUEUE
|
||||
bool IsQueueEmpty() const;
|
||||
size_t GetQueueSize() const;
|
||||
#endif
|
||||
|
||||
void EnableMessageFiltering(MessageQueue::FilterMessageFn && filter);
|
||||
void DisableMessageFiltering();
|
||||
void InstantMessageFilter(MessageQueue::FilterMessageFn && filter);
|
||||
|
||||
private:
|
||||
friend class ThreadsCommutator;
|
||||
|
||||
void PostMessage(drape_ptr<Message> && message, MessagePriority priority);
|
||||
|
||||
MessageQueue m_messageQueue;
|
||||
std::atomic<bool> m_infinityWaiting;
|
||||
};
|
||||
} // namespace df
|
||||
Reference in New Issue
Block a user