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
c582a9fa
Commit
c582a9fa
authored
Nov 12, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/MultiSocketMonitor: add "noexcept"
parent
cf483107
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
35 deletions
+36
-35
MultiSocketMonitor.cxx
src/event/MultiSocketMonitor.cxx
+5
-5
MultiSocketMonitor.hxx
src/event/MultiSocketMonitor.hxx
+18
-18
AlsaInputPlugin.cxx
src/input/plugins/AlsaInputPlugin.cxx
+5
-4
AlsaMixerPlugin.cxx
src/mixer/plugins/AlsaMixerPlugin.cxx
+4
-4
AlsaOutputPlugin.cxx
src/output/plugins/AlsaOutputPlugin.cxx
+4
-4
No files found.
src/event/MultiSocketMonitor.cxx
View file @
c582a9fa
...
@@ -27,13 +27,13 @@
...
@@ -27,13 +27,13 @@
#include <poll.h>
#include <poll.h>
#endif
#endif
MultiSocketMonitor
::
MultiSocketMonitor
(
EventLoop
&
_loop
)
MultiSocketMonitor
::
MultiSocketMonitor
(
EventLoop
&
_loop
)
noexcept
:
IdleMonitor
(
_loop
),
:
IdleMonitor
(
_loop
),
timeout_event
(
_loop
,
BIND_THIS_METHOD
(
OnTimeout
))
{
timeout_event
(
_loop
,
BIND_THIS_METHOD
(
OnTimeout
))
{
}
}
void
void
MultiSocketMonitor
::
Reset
()
MultiSocketMonitor
::
Reset
()
noexcept
{
{
assert
(
GetEventLoop
().
IsInside
());
assert
(
GetEventLoop
().
IsInside
());
...
@@ -44,7 +44,7 @@ MultiSocketMonitor::Reset()
...
@@ -44,7 +44,7 @@ MultiSocketMonitor::Reset()
}
}
void
void
MultiSocketMonitor
::
ClearSocketList
()
MultiSocketMonitor
::
ClearSocketList
()
noexcept
{
{
assert
(
GetEventLoop
().
IsInside
());
assert
(
GetEventLoop
().
IsInside
());
...
@@ -54,7 +54,7 @@ MultiSocketMonitor::ClearSocketList()
...
@@ -54,7 +54,7 @@ MultiSocketMonitor::ClearSocketList()
#ifndef WIN32
#ifndef WIN32
void
void
MultiSocketMonitor
::
ReplaceSocketList
(
pollfd
*
pfds
,
unsigned
n
)
MultiSocketMonitor
::
ReplaceSocketList
(
pollfd
*
pfds
,
unsigned
n
)
noexcept
{
{
pollfd
*
const
end
=
pfds
+
n
;
pollfd
*
const
end
=
pfds
+
n
;
...
@@ -78,7 +78,7 @@ MultiSocketMonitor::ReplaceSocketList(pollfd *pfds, unsigned n)
...
@@ -78,7 +78,7 @@ MultiSocketMonitor::ReplaceSocketList(pollfd *pfds, unsigned n)
#endif
#endif
void
void
MultiSocketMonitor
::
Prepare
()
MultiSocketMonitor
::
Prepare
()
noexcept
{
{
const
auto
timeout
=
PrepareSockets
();
const
auto
timeout
=
PrepareSockets
();
if
(
timeout
>=
timeout
.
zero
())
if
(
timeout
>=
timeout
.
zero
())
...
...
src/event/MultiSocketMonitor.hxx
View file @
c582a9fa
...
@@ -52,30 +52,30 @@ class MultiSocketMonitor : IdleMonitor
...
@@ -52,30 +52,30 @@ class MultiSocketMonitor : IdleMonitor
public
:
public
:
SingleFD
(
MultiSocketMonitor
&
_multi
,
SocketDescriptor
_fd
,
SingleFD
(
MultiSocketMonitor
&
_multi
,
SocketDescriptor
_fd
,
unsigned
events
)
unsigned
events
)
noexcept
:
SocketMonitor
(
_fd
,
_multi
.
GetEventLoop
()),
:
SocketMonitor
(
_fd
,
_multi
.
GetEventLoop
()),
multi
(
_multi
),
revents
(
0
)
{
multi
(
_multi
),
revents
(
0
)
{
Schedule
(
events
);
Schedule
(
events
);
}
}
SocketDescriptor
GetSocket
()
const
{
SocketDescriptor
GetSocket
()
const
noexcept
{
return
SocketMonitor
::
GetSocket
();
return
SocketMonitor
::
GetSocket
();
}
}
unsigned
GetEvents
()
const
{
unsigned
GetEvents
()
const
noexcept
{
return
SocketMonitor
::
GetScheduledFlags
();
return
SocketMonitor
::
GetScheduledFlags
();
}
}
void
SetEvents
(
unsigned
_events
)
{
void
SetEvents
(
unsigned
_events
)
noexcept
{
revents
&=
_events
;
revents
&=
_events
;
SocketMonitor
::
Schedule
(
_events
);
SocketMonitor
::
Schedule
(
_events
);
}
}
unsigned
GetReturnedEvents
()
const
{
unsigned
GetReturnedEvents
()
const
noexcept
{
return
revents
;
return
revents
;
}
}
void
ClearReturnedEvents
()
{
void
ClearReturnedEvents
()
noexcept
{
revents
=
0
;
revents
=
0
;
}
}
...
@@ -113,7 +113,7 @@ public:
...
@@ -113,7 +113,7 @@ public:
static
constexpr
unsigned
ERROR
=
SocketMonitor
::
ERROR
;
static
constexpr
unsigned
ERROR
=
SocketMonitor
::
ERROR
;
static
constexpr
unsigned
HANGUP
=
SocketMonitor
::
HANGUP
;
static
constexpr
unsigned
HANGUP
=
SocketMonitor
::
HANGUP
;
MultiSocketMonitor
(
EventLoop
&
_loop
);
MultiSocketMonitor
(
EventLoop
&
_loop
)
noexcept
;
using
IdleMonitor
::
GetEventLoop
;
using
IdleMonitor
::
GetEventLoop
;
...
@@ -132,13 +132,13 @@ public:
...
@@ -132,13 +132,13 @@ public:
* meantime the #EventLoop thread could invoke those pure
* meantime the #EventLoop thread could invoke those pure
* methods.
* methods.
*/
*/
void
Reset
();
void
Reset
()
noexcept
;
/**
/**
* Invalidate the socket list. A call to PrepareSockets() is
* Invalidate the socket list. A call to PrepareSockets() is
* scheduled which will then update the list.
* scheduled which will then update the list.
*/
*/
void
InvalidateSockets
()
{
void
InvalidateSockets
()
noexcept
{
refresh
=
true
;
refresh
=
true
;
IdleMonitor
::
Schedule
();
IdleMonitor
::
Schedule
();
}
}
...
@@ -148,7 +148,7 @@ public:
...
@@ -148,7 +148,7 @@ public:
*
*
* May only be called from PrepareSockets().
* May only be called from PrepareSockets().
*/
*/
void
AddSocket
(
SocketDescriptor
fd
,
unsigned
events
)
{
void
AddSocket
(
SocketDescriptor
fd
,
unsigned
events
)
noexcept
{
fds
.
emplace_front
(
*
this
,
fd
,
events
);
fds
.
emplace_front
(
*
this
,
fd
,
events
);
}
}
...
@@ -157,7 +157,7 @@ public:
...
@@ -157,7 +157,7 @@ public:
*
*
* May only be called from PrepareSockets().
* May only be called from PrepareSockets().
*/
*/
void
ClearSocketList
();
void
ClearSocketList
()
noexcept
;
/**
/**
* Update the known sockets by invoking the given function for
* Update the known sockets by invoking the given function for
...
@@ -168,7 +168,7 @@ public:
...
@@ -168,7 +168,7 @@ public:
* May only be called from PrepareSockets().
* May only be called from PrepareSockets().
*/
*/
template
<
typename
E
>
template
<
typename
E
>
void
UpdateSocketList
(
E
&&
e
)
{
void
UpdateSocketList
(
E
&&
e
)
noexcept
{
for
(
auto
prev
=
fds
.
before_begin
(),
end
=
fds
.
end
(),
for
(
auto
prev
=
fds
.
before_begin
(),
end
=
fds
.
end
(),
i
=
std
::
next
(
prev
);
i
=
std
::
next
(
prev
);
i
!=
end
;
i
=
std
::
next
(
prev
))
{
i
!=
end
;
i
=
std
::
next
(
prev
))
{
...
@@ -191,7 +191,7 @@ public:
...
@@ -191,7 +191,7 @@ public:
*
*
* May only be called from PrepareSockets().
* May only be called from PrepareSockets().
*/
*/
void
ReplaceSocketList
(
pollfd
*
pfds
,
unsigned
n
);
void
ReplaceSocketList
(
pollfd
*
pfds
,
unsigned
n
)
noexcept
;
#endif
#endif
protected
:
protected
:
...
@@ -202,23 +202,23 @@ protected:
...
@@ -202,23 +202,23 @@ protected:
*
*
* @return timeout or a negative value for no timeout
* @return timeout or a negative value for no timeout
*/
*/
virtual
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
=
0
;
virtual
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
noexcept
=
0
;
/**
/**
* At least one socket is ready or the timeout has expired.
* At least one socket is ready or the timeout has expired.
* This method should be used to perform I/O.
* This method should be used to perform I/O.
*/
*/
virtual
void
DispatchSockets
()
=
0
;
virtual
void
DispatchSockets
()
noexcept
=
0
;
private
:
private
:
void
SetReady
()
{
void
SetReady
()
noexcept
{
ready
=
true
;
ready
=
true
;
IdleMonitor
::
Schedule
();
IdleMonitor
::
Schedule
();
}
}
void
Prepare
();
void
Prepare
()
noexcept
;
void
OnTimeout
()
{
void
OnTimeout
()
noexcept
{
SetReady
();
SetReady
();
IdleMonitor
::
Schedule
();
IdleMonitor
::
Schedule
();
}
}
...
...
src/input/plugins/AlsaInputPlugin.cxx
View file @
c582a9fa
...
@@ -141,8 +141,9 @@ private:
...
@@ -141,8 +141,9 @@ private:
defer_invalidate_sockets
.
Schedule
();
defer_invalidate_sockets
.
Schedule
();
}
}
virtual
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
override
;
/* virtual methods from class MultiSocketMonitor */
virtual
void
DispatchSockets
()
override
;
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
noexcept
override
;
void
DispatchSockets
()
noexcept
override
;
};
};
inline
InputStream
*
inline
InputStream
*
...
@@ -172,7 +173,7 @@ AlsaInputStream::Create(EventLoop &event_loop, const char *uri,
...
@@ -172,7 +173,7 @@ AlsaInputStream::Create(EventLoop &event_loop, const char *uri,
}
}
std
::
chrono
::
steady_clock
::
duration
std
::
chrono
::
steady_clock
::
duration
AlsaInputStream
::
PrepareSockets
()
AlsaInputStream
::
PrepareSockets
()
noexcept
{
{
if
(
IsPaused
())
{
if
(
IsPaused
())
{
ClearSocketList
();
ClearSocketList
();
...
@@ -183,7 +184,7 @@ AlsaInputStream::PrepareSockets()
...
@@ -183,7 +184,7 @@ AlsaInputStream::PrepareSockets()
}
}
void
void
AlsaInputStream
::
DispatchSockets
()
AlsaInputStream
::
DispatchSockets
()
noexcept
{
{
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
protect
(
mutex
);
...
...
src/mixer/plugins/AlsaMixerPlugin.cxx
View file @
c582a9fa
...
@@ -67,8 +67,8 @@ public:
...
@@ -67,8 +67,8 @@ public:
}
}
private
:
private
:
virtual
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
override
;
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
noexcept
override
;
v
irtual
void
DispatchSockets
()
override
;
v
oid
DispatchSockets
()
noexcept
override
;
};
};
class
AlsaMixer
final
:
public
Mixer
{
class
AlsaMixer
final
:
public
Mixer
{
...
@@ -103,7 +103,7 @@ public:
...
@@ -103,7 +103,7 @@ public:
static
constexpr
Domain
alsa_mixer_domain
(
"alsa_mixer"
);
static
constexpr
Domain
alsa_mixer_domain
(
"alsa_mixer"
);
std
::
chrono
::
steady_clock
::
duration
std
::
chrono
::
steady_clock
::
duration
AlsaMixerMonitor
::
PrepareSockets
()
AlsaMixerMonitor
::
PrepareSockets
()
noexcept
{
{
if
(
mixer
==
nullptr
)
{
if
(
mixer
==
nullptr
)
{
ClearSocketList
();
ClearSocketList
();
...
@@ -114,7 +114,7 @@ AlsaMixerMonitor::PrepareSockets()
...
@@ -114,7 +114,7 @@ AlsaMixerMonitor::PrepareSockets()
}
}
void
void
AlsaMixerMonitor
::
DispatchSockets
()
AlsaMixerMonitor
::
DispatchSockets
()
noexcept
{
{
assert
(
mixer
!=
nullptr
);
assert
(
mixer
!=
nullptr
);
...
...
src/output/plugins/AlsaOutputPlugin.cxx
View file @
c582a9fa
...
@@ -297,8 +297,8 @@ private:
...
@@ -297,8 +297,8 @@ private:
}
}
/* virtual methods from class MultiSocketMonitor */
/* virtual methods from class MultiSocketMonitor */
virtual
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
override
;
std
::
chrono
::
steady_clock
::
duration
PrepareSockets
()
noexcept
override
;
v
irtual
void
DispatchSockets
()
override
;
v
oid
DispatchSockets
()
noexcept
override
;
};
};
static
constexpr
Domain
alsa_output_domain
(
"alsa_output"
);
static
constexpr
Domain
alsa_output_domain
(
"alsa_output"
);
...
@@ -799,7 +799,7 @@ AlsaOutput::Play(const void *chunk, size_t size)
...
@@ -799,7 +799,7 @@ AlsaOutput::Play(const void *chunk, size_t size)
}
}
std
::
chrono
::
steady_clock
::
duration
std
::
chrono
::
steady_clock
::
duration
AlsaOutput
::
PrepareSockets
()
AlsaOutput
::
PrepareSockets
()
noexcept
{
{
if
(
LockHasError
())
{
if
(
LockHasError
())
{
ClearSocketList
();
ClearSocketList
();
...
@@ -810,7 +810,7 @@ AlsaOutput::PrepareSockets()
...
@@ -810,7 +810,7 @@ AlsaOutput::PrepareSockets()
}
}
void
void
AlsaOutput
::
DispatchSockets
()
AlsaOutput
::
DispatchSockets
()
noexcept
try
{
try
{
{
{
const
std
::
lock_guard
<
Mutex
>
lock
(
mutex
);
const
std
::
lock_guard
<
Mutex
>
lock
(
mutex
);
...
...
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