Skip to content

Commit

Permalink
minor changes to the setInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanseidel committed May 11, 2013
1 parent de1fd65 commit eaf513d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ void Thread::runned(long time){
_cached_next_run = last_run + interval;
}

Thread Thread::setInterval(long _interval){
void Thread::setInterval(long _interval){
// Filter intervals less than 0
interval = (_interval < 0? 0: _interval);

// Cache the next run based on the last_run
_cached_next_run = last_run + interval;

// Return self object
return *this;
}

bool Thread::shouldRun(long time){
Expand Down
2 changes: 1 addition & 1 deletion Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Thread{
Thread(void (*callback)(void) = NULL, long _interval = 0);

// Set the desired interval for calls, and update _cached_next_run
virtual Thread setInterval(long _interval);
virtual void setInterval(long _interval);

// Return if the Thread should be runned or not
virtual bool shouldRun(long time = -1);
Expand Down

0 comments on commit eaf513d

Please sign in to comment.