template <std::size_t TSize, typename Tlock, typename TCond>
/// @brief Post new handler for execution.
/// @details Acquires regular context lock. The task is added to
/// the execution queue. If the execution queue is empty
/// before the new handler is added, the condition
/// variable is signalled by calling its notify() member
/// @param[in] task R-value reference to new handler functor.
/// @return true in case the handler was successfully posted,
/// false if there is not enough space in the execution
template <typename TTask>
/// @brief Post new handler for execution from interrupt context.
/// @details Acquires interrupt context lock. The task is added to
/// the execution queue. If the execution queue is empty
/// before the new handler is added, the condition variable
/// is signalled by calling its notify() member function.
/// @param[in] task R-value reference to new handler functor.
/// @return true in case the handler was successfully posted, false
/// if there is not enough space in the execution queue.
template <typename TTask>
bool postInterruptCtx(TTask&& task);
/// @brief Event loop execution function.
/// @details The function keeps executing posted handlers until
/// none are left. When execution queue becomes empty the
/// wait(...) member function of the condition variable
/// gets called to execute blocking wait for new handlers.
/// When new handler is added, the condition variable will
/// be signalled and blocking wait is expected to be
/// terminated to continue execution of the event loop.
/// This function never exits unless stop() was called to
/// terminate the execution. After stopping the main
/// loop, use reset() member function to enable the loop
/// to be executed again.
/// @brief Stop execution of the event loop.
/// @details The execution may not be stopped immediately. If there
/// is an event handler being executed, the loop will be
/// stopped after the execution of the handler is finished.
/// @brief Reset the state of the event loop.
/// @details Clear the queue of registered event handlers and
/// resets the "stopped" flag to allow new event loop