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
87fce8ef
Commit
87fce8ef
authored
Jan 04, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mixer/alsa: use DeferredMonitor to update file descriptors
EventLoop::AddCall() and EventLoop::AddIdle() are unsafe, because we can't cancel those calls.
parent
d2a4f64f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
14 deletions
+7
-14
AlsaMixerPlugin.cxx
src/mixer/AlsaMixerPlugin.cxx
+7
-14
No files found.
src/mixer/AlsaMixerPlugin.cxx
View file @
87fce8ef
...
...
@@ -23,8 +23,8 @@
#include "GlobalEvents.hxx"
#include "Main.hxx"
#include "event/MultiSocketMonitor.hxx"
#include "event/DeferredMonitor.hxx"
#include "event/Loop.hxx"
#include "event/Call.hxx"
#include "util/ASCII.hxx"
#include "util/ReusableArray.hxx"
#include "util/Clamp.hxx"
...
...
@@ -40,29 +40,22 @@
#define VOLUME_MIXER_ALSA_CONTROL_DEFAULT "PCM"
static
constexpr
unsigned
VOLUME_MIXER_ALSA_INDEX_DEFAULT
=
0
;
class
AlsaMixerMonitor
final
:
private
MultiSocket
Monitor
{
class
AlsaMixerMonitor
final
:
MultiSocketMonitor
,
Deferred
Monitor
{
snd_mixer_t
*
mixer
;
ReusableArray
<
pollfd
>
pfd_buffer
;
public
:
AlsaMixerMonitor
(
EventLoop
&
_loop
,
snd_mixer_t
*
_mixer
)
:
MultiSocketMonitor
(
_loop
),
mixer
(
_mixer
)
{
#ifdef USE_INTERNAL_EVENTLOOP
_loop
.
AddCall
([
this
](){
InvalidateSockets
();
});
#else
_loop
.
AddIdle
(
InitAlsaMixerMonitor
,
this
);
#endif
:
MultiSocketMonitor
(
_loop
),
DeferredMonitor
(
_loop
),
mixer
(
_mixer
)
{
DeferredMonitor
::
Schedule
();
}
private
:
#ifndef USE_INTERNAL_EVENTLOOP
static
gboolean
InitAlsaMixerMonitor
(
gpointer
data
)
{
AlsaMixerMonitor
&
amm
=
*
(
AlsaMixerMonitor
*
)
data
;
amm
.
InvalidateSockets
();
return
false
;
virtual
void
RunDeferred
()
override
{
InvalidateSockets
();
}
#endif
virtual
int
PrepareSockets
()
override
;
virtual
void
DispatchSockets
()
override
;
...
...
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