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
1624a5eb
Commit
1624a5eb
authored
Jun 23, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Control: add another Cond attribute, replacing audio_output_client_notify
parent
1bca29f9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
33 deletions
+13
-33
Control.cxx
src/output/Control.cxx
+2
-7
Control.hxx
src/output/Control.hxx
+6
-0
Filtered.hxx
src/output/Filtered.hxx
+0
-6
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+3
-13
MultipleOutputs.hxx
src/output/MultipleOutputs.hxx
+1
-4
Thread.cxx
src/output/Thread.cxx
+1
-3
No files found.
src/output/Control.cxx
View file @
1624a5eb
...
...
@@ -22,7 +22,6 @@
#include "Filtered.hxx"
#include "Domain.hxx"
#include "mixer/MixerControl.hxx"
#include "notify.hxx"
#include "filter/plugins/ReplayGainFilterPlugin.hxx"
#include "config/Block.hxx"
#include "Log.hxx"
...
...
@@ -35,8 +34,6 @@
automatically reopening the device */
static
constexpr
PeriodClock
::
Duration
REOPEN_AFTER
=
std
::
chrono
::
seconds
(
10
);
struct
notify
audio_output_client_notify
;
AudioOutputControl
::
AudioOutputControl
(
std
::
unique_ptr
<
FilteredAudioOutput
>
_output
,
AudioOutputClient
&
_client
)
noexcept
:
output
(
std
::
move
(
_output
)),
client
(
_client
),
...
...
@@ -116,10 +113,8 @@ AudioOutputControl::LockToggleEnabled() noexcept
void
AudioOutputControl
::
WaitForCommand
()
noexcept
{
while
(
!
IsCommandFinished
())
{
const
ScopeUnlock
unlock
(
mutex
);
audio_output_client_notify
.
Wait
();
}
while
(
!
IsCommandFinished
())
client_cond
.
wait
(
mutex
);
}
void
...
...
src/output/Control.hxx
View file @
1624a5eb
...
...
@@ -94,6 +94,12 @@ class AudioOutputControl {
Cond
wake_cond
;
/**
* This condition object signals #command completion to the
* client.
*/
Cond
client_cond
;
/**
* Additional data for #command. Protected by #mutex.
*/
struct
Request
{
...
...
src/output/Filtered.hxx
View file @
1624a5eb
...
...
@@ -229,12 +229,6 @@ public:
};
/**
* Notify object used by the thread's client, i.e. we will send a
* notify signal to this object, expecting the caller to wait on it.
*/
extern
struct
notify
audio_output_client_notify
;
/**
* Throws #std::runtime_error on error.
*/
std
::
unique_ptr
<
FilteredAudioOutput
>
...
...
src/output/MultipleOutputs.cxx
View file @
1624a5eb
...
...
@@ -26,7 +26,6 @@
#include "config/Block.hxx"
#include "config/ConfigGlobal.hxx"
#include "config/ConfigOption.hxx"
#include "notify.hxx"
#include "util/RuntimeError.hxx"
#include <stdexcept>
...
...
@@ -155,23 +154,14 @@ MultipleOutputs::EnableDisable()
}
}
bool
MultipleOutputs
::
AllFinished
()
const
noexcept
void
MultipleOutputs
::
WaitAll
()
noexcept
{
for
(
auto
*
ao
:
outputs
)
{
const
std
::
lock_guard
<
Mutex
>
protect
(
ao
->
mutex
);
if
(
ao
->
IsBusy
())
return
false
;
ao
->
WaitForCommand
()
;
}
return
true
;
}
void
MultipleOutputs
::
WaitAll
()
noexcept
{
while
(
!
AllFinished
())
audio_output_client_notify
.
Wait
();
}
void
...
...
src/output/MultipleOutputs.hxx
View file @
1624a5eb
...
...
@@ -145,12 +145,9 @@ public:
private
:
/**
*
Determine if
all (active) outputs have finished the current
*
Wait until
all (active) outputs have finished the current
* command.
*/
gcc_pure
bool
AllFinished
()
const
noexcept
;
void
WaitAll
()
noexcept
;
/**
...
...
src/output/Thread.cxx
View file @
1624a5eb
...
...
@@ -22,7 +22,6 @@
#include "Filtered.hxx"
#include "Client.hxx"
#include "Domain.hxx"
#include "notify.hxx"
#include "mixer/MixerInternal.hxx"
#include "thread/Util.hxx"
#include "thread/Slack.hxx"
...
...
@@ -41,8 +40,7 @@ AudioOutputControl::CommandFinished() noexcept
assert
(
command
!=
Command
::
NONE
);
command
=
Command
::
NONE
;
const
ScopeUnlock
unlock
(
mutex
);
audio_output_client_notify
.
Signal
();
client_cond
.
signal
();
}
inline
void
...
...
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