Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
Ratas
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Ratas
Commits
fab654db
Commit
fab654db
authored
Aug 01, 2016
by
Juho Snellman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation improvements
parent
4e51f48d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
README.org
README.org
+7
-5
src/timer-wheel.h
src/timer-wheel.h
+4
-2
No files found.
README.org
View file @
fab654db
...
...
@@ -83,7 +83,7 @@ for execution (with =schedule()= or =schedule_in_range()=), and will
eventually be executed once the time advances far enough with the
=advance()= method.
***** =TimerWheel::advance(Tick delta, int level = 0)=
***** =TimerWheel::advance(Tick delta,
size_t max_execute = ...,
int level = 0)=
Advance the TimerWheel by the specified number of ticks (=delta=), and execute
any events scheduled for execution at or before that time. The
number of events executed can be restricted using the =max_execute=
...
...
@@ -100,28 +100,30 @@ and the excess events will be processed on a subsequent call.
Delta should be non-0. The only exception is if the previous
call to =advance()= returned false.
=advance()= should not be called from an event callback.
The =level= parameter is used to trigger timer advances on different
levels of the hierarchy. It will generally not be useful to pass in
any value other than the default 0.
***** =schedule(TimerEventInterface* event, Tick delta)=
***** =
TimerWheel::
schedule(TimerEventInterface* event, Tick delta)=
Schedule the event to be executed =delta= ticks from the current time.
The delta must be non-0.
***** =schedule_in_range(TimerEventInterface* event, Tick start, Tick end)=
***** =
TimerWheel::
schedule_in_range(TimerEventInterface* event, Tick start, Tick end)=
Schedule the event to happen at some time between start and end
ticks from the current time. The actual time will be determined
by the =TimerWheel= to minimize rescheduling and promotion overhead.
Both =start= and =end= must be non-0, and =end= must be greater than
=start=.
***** =now()=
***** =
TimerWheel::
now()=
Return the current tick value. Note that if the time increases
by multiple ticks during a single call to advance(), during the
execution of the event callback now() will return the tick that
the event was scheduled to run on.
***** =
ticks_to_next_event(const Tick&
max = ..., int level = 0)=
***** =
TimerWheel::ticks_to_next_event(Tick
max = ..., int level = 0)=
Return the number of ticks remaining until the next event will get
executed. If the max parameter is passed, that will be the maximum
tick value that gets returned. The max parameter's value will also
...
...
src/timer-wheel.h
View file @
fab654db
...
...
@@ -239,6 +239,8 @@ public:
//
// Delta should be non-0. The only exception is if the previous
// call to advance() returned false.
//
// advance() should not be called from an event callback.
bool
advance
(
Tick
delta
,
size_t
max_execute
=
std
::
numeric_limits
<
size_t
>::
max
(),
int
level
=
0
);
...
...
@@ -268,7 +270,7 @@ public:
//
// Will return 0 if the wheel still has unprocessed events from the
// previous call to advance().
Tick
ticks_to_next_event
(
const
Tick
&
max
=
std
::
numeric_limits
<
Tick
>::
max
(),
Tick
ticks_to_next_event
(
Tick
max
=
std
::
numeric_limits
<
Tick
>::
max
(),
int
level
=
0
);
private:
...
...
@@ -467,7 +469,7 @@ void TimerWheel::schedule_in_range(TimerEventInterface* event,
schedule
(
event
,
delta
);
}
Tick
TimerWheel
::
ticks_to_next_event
(
const
Tick
&
max
,
int
level
)
{
Tick
TimerWheel
::
ticks_to_next_event
(
Tick
max
,
int
level
)
{
if
(
ticks_pending_
)
{
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment