Code review changes

This commit is contained in:
John Wellbelove 2026-10-29 23:00:51 +00:00
parent 5e5903cdff
commit a71bf72346
4 changed files with 31 additions and 71 deletions

View File

@ -142,24 +142,42 @@ namespace etl
#endif
// Timer owner.
struct owner
{
typedef void* type;
#if ETL_USING_CPP11
static ETL_CONSTANT type No_Owner = ETL_NULLPTR;
namespace private_timer
{
template <typename TDummy>
struct owner_static
{
using type = const void*;
static constexpr type No_Owner = nullptr;
};
template <typename TDummy>
constexpr typename owner_static<TDummy>::type owner_static<TDummy>::No_Owner;
} // namespace private_timer
#else
static ETL_CONSTANT type No_Owner;
namespace private_timer
{
template <typename TDummy>
struct owner_static
{
typedef const void* type;
static const type No_Owner;
};
template <typename TDummy>
const typename owner_static<TDummy>::type owner_static<TDummy>::No_Owner = ETL_NULLPTR;
}
#endif
struct owner : private_timer::owner_static<void>
{
};
#if ETL_USING_CPP11
using owner_t = owner::type;
#endif
#if ETL_NOT_USING_CPP11
owner::type const owner::No_Owner = ETL_NULLPTR;
#endif
} // namespace timer
} // namespace etl

View File

@ -97,7 +97,8 @@ namespace etl
etl::atomic_bool lock_flag;
};
#endif
}
}
#endif
#endif

View File

@ -289,7 +289,7 @@ namespace etl
node* registered_next; ///< The next timer in the registered timer list. unlinked() if the timer is not registered.
node* active_next; ///< The next timer in the active timer list. unlinked() if the timer is not active.
node* expired_next; ///< The next timer in the expired timer list. unlinked() if the timer is not expired.
void* owner; ///< The owner of the timer.
const void* owner; ///< The owner of the timer.
etl::timer::config config; ///< The configuration of the timer.
etl::timer::interval::type delta; ///< The time remaining until the timer expires.
};

View File

@ -1,59 +0,0 @@
/******************************************************************************
The MIT License(MIT)
Embedded Template Library.
https://github.com/ETLCPP/etl
https://www.etlcpp.com
Copyright(c) 2017 John Wellbelove
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
******************************************************************************/
#ifndef ETL_TIMER_NOTIFICATION_INCLUDED
#define ETL_TIMER_NOTIFICATION_INCLUDED
#include "platform.h"
//*****************************************************************************
// Definitions common to timers.
//*****************************************************************************
namespace etl
{
namespace timer
{
//***************************************************************************
/// Default class for time to next notification
//***************************************************************************
class timer_time_to_next_notification
{
public:
virtual ~timer_time_to_next_notification() ETL_NOEXCEPT {}
virtual void invoke(uint32_t)
{
// Do nothing by default.
}
};
}; // namespace timer
} // namespace etl
#endif