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
7e0cdbe5
Commit
7e0cdbe5
authored
Dec 30, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Thread: use ScopeUnlock for exception-safety
parent
ca08902d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+22
-21
No files found.
src/decoder/DecoderThread.cxx
View file @
7e0cdbe5
...
...
@@ -144,15 +144,15 @@ decoder_stream_decode(const DecoderPlugin &plugin,
/* rewind the stream, so each plugin gets a fresh start */
input_stream
.
Rewind
(
IgnoreError
());
decoder
.
dc
.
Unlock
();
{
const
ScopeUnlock
unlock
(
decoder
.
dc
.
mutex
);
FormatThreadName
(
"decoder:%s"
,
plugin
.
name
);
FormatThreadName
(
"decoder:%s"
,
plugin
.
name
);
plugin
.
StreamDecode
(
decoder
,
input_stream
);
plugin
.
StreamDecode
(
decoder
,
input_stream
);
SetThreadName
(
"decoder"
);
decoder
.
dc
.
Lock
();
SetThreadName
(
"decoder"
);
}
assert
(
decoder
.
dc
.
state
==
DecoderState
::
START
||
decoder
.
dc
.
state
==
DecoderState
::
DECODE
);
...
...
@@ -181,15 +181,15 @@ decoder_file_decode(const DecoderPlugin &plugin,
if
(
decoder
.
dc
.
command
==
DecoderCommand
::
STOP
)
return
true
;
decoder
.
dc
.
Unlock
();
{
const
ScopeUnlock
unlock
(
decoder
.
dc
.
mutex
);
FormatThreadName
(
"decoder:%s"
,
plugin
.
name
);
FormatThreadName
(
"decoder:%s"
,
plugin
.
name
);
plugin
.
FileDecode
(
decoder
,
path
);
SetThreadName
(
"decoder"
);
plugin
.
FileDecode
(
decoder
,
path
);
decoder
.
dc
.
Lock
();
SetThreadName
(
"decoder"
);
}
assert
(
decoder
.
dc
.
state
==
DecoderState
::
START
||
decoder
.
dc
.
state
==
DecoderState
::
DECODE
);
...
...
@@ -389,18 +389,19 @@ decoder_run_song(DecoderControl &dc,
decoder_command_finished_locked
(
dc
);
dc
.
Unlock
();
const
int
ret
=
!
path_fs
.
IsNull
()
?
decoder_run_file
(
decoder
,
uri
,
path_fs
)
:
decoder_run_stream
(
decoder
,
uri
);
int
ret
;
{
const
ScopeUnlock
unlock
(
dc
.
mutex
);
/* flush the last chunk */
ret
=
!
path_fs
.
IsNull
()
?
decoder_run_file
(
decoder
,
uri
,
path_fs
)
:
decoder_run_stream
(
decoder
,
uri
);
if
(
decoder
.
chunk
!=
nullptr
)
decoder
.
FlushChunk
();
/* flush the last chunk */
dc
.
Lock
();
if
(
decoder
.
chunk
!=
nullptr
)
decoder
.
FlushChunk
();
}
if
(
decoder
.
error
.
IsDefined
())
{
/* copy the Error from sruct Decoder to
...
...
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