Skip to content

Commit 206b723

Browse files
committed
tweak timer start() initialization code layout
1 parent a0414e8 commit 206b723

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

libraries/chain/platform_timer_asio_fallback.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ platform_timer::~platform_timer() {
5757

5858
void platform_timer::start(fc::time_point tp) {
5959
assert(_state == state_t::stopped);
60-
if(tp == fc::time_point::maximum()) {
60+
timer_running_forever = tp == fc::time_point::maximum();
61+
if(timer_running_forever) {
6162
_state = state_t::running;
62-
timer_running_forever = true;
6363
return;
6464
}
6565
fc::microseconds x = tp.time_since_epoch() - fc::time_point::now().time_since_epoch();

libraries/chain/platform_timer_kqueue.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ platform_timer::~platform_timer() {
8989

9090
void platform_timer::start(fc::time_point tp) {
9191
assert(_state == state_t::stopped);
92-
if(tp == fc::time_point::maximum()) {
92+
timer_running_forever = tp == fc::time_point::maximum();
93+
if(timer_running_forever) {
9394
_state = state_t::running;
94-
timer_running_forever = true;
9595
return;
9696
}
9797
fc::microseconds x = tp.time_since_epoch() - fc::time_point::now().time_since_epoch();

libraries/chain/platform_timer_posix.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ platform_timer::~platform_timer() {
5656

5757
void platform_timer::start(fc::time_point tp) {
5858
assert(_state == state_t::stopped);
59-
if(tp == fc::time_point::maximum()) {
59+
timer_running_forever = tp == fc::time_point::maximum();
60+
if(timer_running_forever) {
6061
_state = state_t::running;
61-
timer_running_forever = true;
6262
return;
6363
}
6464
fc::microseconds x = tp.time_since_epoch() - fc::time_point::now().time_since_epoch();
65-
timer_running_forever = false;
6665
if(x.count() <= 0)
6766
_state = state_t::timed_out;
6867
else {

0 commit comments

Comments
 (0)