Files
MuditaOS/module-services/service-gui/SynchronizationMechanism.hpp
Piotr Tański 3f29c30bed [EGD-4968] Change GUI service to optimize flow and memory management
Gui and Eink services refactor.
Displaying frames performance optimization.
Critical resources management.
2021-01-08 16:36:12 +01:00

27 lines
905 B
C++

// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
#include <mutex.hpp>
#include <chrono>
#include <functional>
#include <memory>
namespace service::gui
{
/// Interface providing platform-independent synchronization strategy.
class SynchronizationMechanism
{
public:
using Predicate = std::function<bool()>;
virtual ~SynchronizationMechanism() noexcept = default;
virtual void wait(cpp_freertos::Mutex &lock, std::chrono::milliseconds timeout, Predicate predicate) = 0;
virtual void notify() = 0;
};
std::unique_ptr<SynchronizationMechanism> getFreeRtosSynchronizationMechanism();
} // namespace service::gui