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
f6479962
Commit
f6479962
authored
Oct 18, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/IdleEvent: use class IntrusiveList<>
parent
6f0ad2b6
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
39 deletions
+10
-39
IdleEvent.cxx
src/event/IdleEvent.cxx
+0
-11
IdleEvent.hxx
src/event/IdleEvent.hxx
+8
-15
Loop.cxx
src/event/Loop.cxx
+0
-8
Loop.hxx
src/event/Loop.hxx
+2
-5
No files found.
src/event/IdleEvent.cxx
View file @
f6479962
...
...
@@ -23,17 +23,6 @@
#include <cassert>
void
IdleEvent
::
Cancel
()
noexcept
{
assert
(
loop
.
IsInside
());
if
(
!
IsActive
())
return
;
loop
.
RemoveIdle
(
*
this
);
}
void
IdleEvent
::
Schedule
()
noexcept
{
assert
(
loop
.
IsInside
());
...
...
src/event/IdleEvent.hxx
View file @
f6479962
...
...
@@ -21,8 +21,7 @@
#define MPD_SOCKET_IDLE_EVENT_HXX
#include "util/BindMethod.hxx"
#include <boost/intrusive/list_hook.hpp>
#include "util/IntrusiveList.hxx"
class
EventLoop
;
...
...
@@ -34,10 +33,9 @@ class EventLoop;
* thread that runs the #EventLoop, except where explicitly documented
* as thread-safe.
*/
class
IdleEvent
:
public
boost
::
intrusive
::
list_base_hook
<>
{
class
IdleEvent
final
:
public
AutoUnlinkIntrusiveListHook
{
friend
class
EventLoop
;
friend
class
IntrusiveList
<
IdleEvent
>
;
EventLoop
&
loop
;
...
...
@@ -51,15 +49,6 @@ public:
IdleEvent
(
const
IdleEvent
&
)
=
delete
;
IdleEvent
&
operator
=
(
const
IdleEvent
&
)
=
delete
;
~
IdleEvent
()
noexcept
{
#ifndef NDEBUG
/* this check is redundant, it is only here to avoid
the assertion in Cancel() */
if
(
IsActive
())
#endif
Cancel
();
}
auto
&
GetEventLoop
()
const
noexcept
{
return
loop
;
}
...
...
@@ -69,7 +58,11 @@ public:
}
void
Schedule
()
noexcept
;
void
Cancel
()
noexcept
;
void
Cancel
()
noexcept
{
if
(
IsActive
())
unlink
();
}
private
:
void
Run
()
noexcept
;
...
...
src/event/Loop.cxx
View file @
f6479962
...
...
@@ -130,14 +130,6 @@ EventLoop::AddIdle(IdleEvent &i) noexcept
}
void
EventLoop
::
RemoveIdle
(
IdleEvent
&
i
)
noexcept
{
assert
(
IsInside
());
idle
.
erase
(
idle
.
iterator_to
(
i
));
}
void
EventLoop
::
AddTimer
(
TimerEvent
&
t
,
Event
::
Duration
d
)
noexcept
{
assert
(
IsInside
());
...
...
src/event/Loop.hxx
View file @
f6479962
...
...
@@ -25,6 +25,7 @@
#include "SocketEvent.hxx"
#include "event/Features.h"
#include "util/Compiler.h"
#include "util/IntrusiveList.hxx"
#ifdef HAVE_THREADED_EVENT_LOOP
#include "WakeFD.hxx"
...
...
@@ -77,10 +78,7 @@ class EventLoop final
boost
::
intrusive
::
constant_time_size
<
false
>>
;
TimerSet
timers
;
using
IdleList
=
boost
::
intrusive
::
list
<
IdleEvent
,
boost
::
intrusive
::
base_hook
<
boost
::
intrusive
::
list_base_hook
<>>
,
boost
::
intrusive
::
constant_time_size
<
false
>>
;
using
IdleList
=
IntrusiveList
<
IdleEvent
>
;
IdleList
idle
;
#ifdef HAVE_THREADED_EVENT_LOOP
...
...
@@ -214,7 +212,6 @@ public:
bool
AbandonFD
(
int
fd
)
noexcept
;
void
AddIdle
(
IdleEvent
&
i
)
noexcept
;
void
RemoveIdle
(
IdleEvent
&
i
)
noexcept
;
void
AddTimer
(
TimerEvent
&
t
,
Event
::
Duration
d
)
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