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
302c0515
Commit
302c0515
authored
May 17, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/buffering: move code to RunThreadLocked()
parent
19e4672a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
BufferingInputStream.cxx
src/input/BufferingInputStream.cxx
+12
-6
BufferingInputStream.hxx
src/input/BufferingInputStream.hxx
+1
-0
No files found.
src/input/BufferingInputStream.cxx
View file @
302c0515
...
...
@@ -134,13 +134,9 @@ BufferingInputStream::FindFirstHole() const noexcept
return
INVALID_OFFSET
;
}
void
BufferingInputStream
::
RunThread
(
)
noexcept
inline
void
BufferingInputStream
::
RunThread
Locked
(
std
::
unique_lock
<
Mutex
>
&
lock
)
noexcept
{
SetThreadName
(
"buffering"
);
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
while
(
!
stop
)
{
if
(
seek
)
{
try
{
...
...
@@ -256,6 +252,16 @@ BufferingInputStream::RunThread() noexcept
}
else
wake_cond
.
wait
(
lock
);
}
}
void
BufferingInputStream
::
RunThread
()
noexcept
{
SetThreadName
(
"buffering"
);
std
::
unique_lock
<
Mutex
>
lock
(
mutex
);
RunThreadLocked
(
lock
);
/* clear the "input" attribute while holding the mutex */
auto
_input
=
std
::
move
(
input
);
...
...
src/input/BufferingInputStream.hxx
View file @
302c0515
...
...
@@ -88,6 +88,7 @@ protected:
private
:
size_t
FindFirstHole
()
const
noexcept
;
void
RunThreadLocked
(
std
::
unique_lock
<
Mutex
>
&
lock
)
noexcept
;
void
RunThread
()
noexcept
;
/* virtual methods from class InputStreamHandler */
...
...
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