Skip to content

Commit

Permalink
GH-1095 Make expire_now() private
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jan 16, 2025
1 parent 0f4fbb4 commit d072fcd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions libraries/chain/include/eosio/chain/platform_timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ struct platform_timer {
void start(fc::time_point tp);
void stop();
void interrupt_timer();
void _expire_now(); // called by internal timer

/* Sets a callback for when timer expires. Be aware this could might fire from a signal handling context and/or
on any particular thread. Only a single callback can be registered at once; trying to register more will
Expand All @@ -43,8 +42,9 @@ struct platform_timer {
state_t timer_state() const { return _state; }

private:
std::atomic<state_t> _state = state_t::stopped;
void expire_now();

std::atomic<state_t> _state = state_t::stopped;

struct impl;
constexpr static size_t fwd_size = 8;
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/platform_timer_asio_fallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ void platform_timer::start(fc::time_point tp) {
my->timer->async_wait([this](const boost::system::error_code& ec) {
if(ec)
return;
_expire_now();
expire_now();
});
}
}

void platform_timer::_expire_now() {
void platform_timer::expire_now() {
state_t expected = state_t::running;
if (_state.compare_exchange_strong(expected, state_t::timed_out)) {
call_expiration_callback();
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/platform_timer_kqueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ platform_timer::platform_timer() {

if(c == 1 && anEvent.filter == EVFILT_TIMER) {
platform_timer* self = (platform_timer*)anEvent.udata;
self->_expire_now();
self->expire_now();
}
else if(c == 1 && anEvent.filter == EVFILT_USER)
return;
Expand Down Expand Up @@ -105,7 +105,7 @@ void platform_timer::start(fc::time_point tp) {
}
}

void platform_timer::_expire_now() {
void platform_timer::expire_now() {
state_t expected = state_t::running;
if (_state.compare_exchange_strong(expected, state_t::timed_out)) {
call_expiration_callback();
Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/platform_timer_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct platform_timer::impl {

static void sig_handler(int, siginfo_t* si, void*) {
platform_timer* self = (platform_timer*)si->si_value.sival_ptr;
self->_expire_now();
self->expire_now();
}
};

Expand Down Expand Up @@ -72,7 +72,7 @@ void platform_timer::start(fc::time_point tp) {
}
}

void platform_timer::_expire_now() {
void platform_timer::expire_now() {
state_t expected = state_t::running;
if (_state.compare_exchange_strong(expected, state_t::timed_out)) {
call_expiration_callback();
Expand Down

0 comments on commit d072fcd

Please sign in to comment.