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
ec113420
Commit
ec113420
authored
Jan 03, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Thread: hold mutex while calling SongBorder()
Eliminates unnecessary mutex locks.
parent
1954e94d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
15 deletions
+11
-15
Control.hxx
src/player/Control.hxx
+0
-5
Thread.cxx
src/player/Thread.cxx
+11
-10
No files found.
src/player/Control.hxx
View file @
ec113420
...
...
@@ -414,11 +414,6 @@ public:
return
border_pause
;
}
bool
LockApplyBorderPause
()
noexcept
{
const
std
::
lock_guard
<
Mutex
>
lock
(
mutex
);
return
ApplyBorderPause
();
}
void
Kill
()
noexcept
;
gcc_pure
...
...
src/player/Thread.cxx
View file @
ec113420
...
...
@@ -333,7 +333,7 @@ private:
* has consumed all chunks of the current song, and we should start
* sending chunks from the next one.
*
*
The player lock is not held
.
*
Caller must lock the mutex
.
*/
void
SongBorder
()
noexcept
;
...
...
@@ -968,20 +968,22 @@ Player::PlayNextChunk() noexcept
inline
void
Player
::
SongBorder
()
noexcept
{
FormatDefault
(
player_domain
,
"played
\"
%s
\"
"
,
song
->
GetURI
());
{
const
ScopeUnlock
unlock
(
pc
.
mutex
);
throttle_silence_log
.
Reset
(
);
FormatDefault
(
player_domain
,
"played
\"
%s
\"
"
,
song
->
GetURI
()
);
ReplacePipe
(
dc
.
pipe
);
throttle_silence_log
.
Reset
(
);
pc
.
outputs
.
SongBorder
(
);
ReplacePipe
(
dc
.
pipe
);
{
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
ActivateDecoder
();
pc
.
outputs
.
SongBorder
();
}
const
bool
border_pause
=
pc
.
LockApplyBorderPause
();
ActivateDecoder
();
const
bool
border_pause
=
pc
.
ApplyBorderPause
();
if
(
border_pause
)
{
paused
=
true
;
idle_add
(
IDLE_PLAYER
);
...
...
@@ -1101,7 +1103,6 @@ Player::Run() noexcept
}
else
if
(
IsDecoderAtNextSong
())
{
/* at the beginning of a new song */
const
ScopeUnlock
unlock
(
pc
.
mutex
);
SongBorder
();
}
else
if
(
dc
.
IsIdle
())
{
/* check the size of the pipe again, because
...
...
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