Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
263b0ffd
Commit
263b0ffd
authored
Oct 08, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/TimerEvent: use auto_unlink hook
parent
22bea5c9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
23 deletions
+6
-23
Loop.cxx
src/event/Loop.cxx
+0
-8
Loop.hxx
src/event/Loop.hxx
+1
-2
TimerEvent.cxx
src/event/TimerEvent.cxx
+0
-7
TimerEvent.hxx
src/event/TimerEvent.hxx
+5
-6
No files found.
src/event/Loop.cxx
View file @
263b0ffd
...
...
@@ -131,14 +131,6 @@ EventLoop::AddTimer(TimerEvent &t, std::chrono::steady_clock::duration d) noexce
again
=
true
;
}
void
EventLoop
::
CancelTimer
(
TimerEvent
&
t
)
noexcept
{
assert
(
IsInside
());
timers
.
erase
(
timers
.
iterator_to
(
t
));
}
inline
std
::
chrono
::
steady_clock
::
duration
EventLoop
::
HandleTimers
()
noexcept
{
...
...
src/event/Loop.hxx
View file @
263b0ffd
...
...
@@ -64,7 +64,7 @@ class EventLoop final : SocketMonitor
using
TimerSet
=
boost
::
intrusive
::
multiset
<
TimerEvent
,
boost
::
intrusive
::
base_hook
<
boost
::
intrusive
::
set_base_hook
<>>
,
boost
::
intrusive
::
base_hook
<
boost
::
intrusive
::
set_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
auto_unlink
>
>>
,
boost
::
intrusive
::
compare
<
TimerCompare
>
,
boost
::
intrusive
::
constant_time_size
<
false
>>
;
TimerSet
timers
;
...
...
@@ -186,7 +186,6 @@ public:
void
AddTimer
(
TimerEvent
&
t
,
std
::
chrono
::
steady_clock
::
duration
d
)
noexcept
;
void
CancelTimer
(
TimerEvent
&
t
)
noexcept
;
/**
* Schedule a call to DeferEvent::RunDeferred().
...
...
src/event/TimerEvent.cxx
View file @
263b0ffd
...
...
@@ -21,13 +21,6 @@
#include "Loop.hxx"
void
TimerEvent
::
Cancel
()
noexcept
{
if
(
IsActive
())
loop
.
CancelTimer
(
*
this
);
}
void
TimerEvent
::
Schedule
(
std
::
chrono
::
steady_clock
::
duration
d
)
noexcept
{
Cancel
();
...
...
src/event/TimerEvent.hxx
View file @
263b0ffd
...
...
@@ -37,7 +37,7 @@ class EventLoop;
* as thread-safe.
*/
class
TimerEvent
final
:
public
boost
::
intrusive
::
set_base_hook
<>
:
public
boost
::
intrusive
::
set_base_hook
<
boost
::
intrusive
::
link_mode
<
boost
::
intrusive
::
auto_unlink
>
>
{
friend
class
EventLoop
;
...
...
@@ -57,10 +57,6 @@ public:
:
loop
(
_loop
),
callback
(
_callback
)
{
}
~
TimerEvent
()
noexcept
{
Cancel
();
}
auto
&
GetEventLoop
()
const
noexcept
{
return
loop
;
}
...
...
@@ -70,7 +66,10 @@ public:
}
void
Schedule
(
std
::
chrono
::
steady_clock
::
duration
d
)
noexcept
;
void
Cancel
()
noexcept
;
void
Cancel
()
noexcept
{
unlink
();
}
private
:
void
Run
()
noexcept
{
...
...
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