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
2939fadd
Commit
2939fadd
authored
Dec 31, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/Control: use ScopeLock
parent
ef260377
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
27 deletions
+13
-27
DecoderControl.cxx
src/decoder/DecoderControl.cxx
+1
-3
DecoderControl.hxx
src/decoder/DecoderControl.hxx
+12
-24
No files found.
src/decoder/DecoderControl.cxx
View file @
2939fadd
...
@@ -90,7 +90,7 @@ DecoderControl::Start(DetachedSong *_song,
...
@@ -90,7 +90,7 @@ DecoderControl::Start(DetachedSong *_song,
void
void
DecoderControl
::
Stop
()
DecoderControl
::
Stop
()
{
{
Lock
(
);
const
ScopeLock
protect
(
mutex
);
if
(
command
!=
DecoderCommand
::
NONE
)
if
(
command
!=
DecoderCommand
::
NONE
)
/* Attempt to cancel the current command. If it's too
/* Attempt to cancel the current command. If it's too
...
@@ -101,8 +101,6 @@ DecoderControl::Stop()
...
@@ -101,8 +101,6 @@ DecoderControl::Stop()
if
(
state
!=
DecoderState
::
STOP
&&
state
!=
DecoderState
::
ERROR
)
if
(
state
!=
DecoderState
::
STOP
&&
state
!=
DecoderState
::
ERROR
)
SynchronousCommandLocked
(
DecoderCommand
::
STOP
);
SynchronousCommandLocked
(
DecoderCommand
::
STOP
);
Unlock
();
}
}
bool
bool
...
...
src/decoder/DecoderControl.hxx
View file @
2939fadd
...
@@ -213,10 +213,8 @@ struct DecoderControl {
...
@@ -213,10 +213,8 @@ struct DecoderControl {
gcc_pure
gcc_pure
bool
LockIsIdle
()
const
{
bool
LockIsIdle
()
const
{
Lock
();
const
ScopeLock
protect
(
mutex
);
bool
result
=
IsIdle
();
return
IsIdle
();
Unlock
();
return
result
;
}
}
bool
IsStarting
()
const
{
bool
IsStarting
()
const
{
...
@@ -225,10 +223,8 @@ struct DecoderControl {
...
@@ -225,10 +223,8 @@ struct DecoderControl {
gcc_pure
gcc_pure
bool
LockIsStarting
()
const
{
bool
LockIsStarting
()
const
{
Lock
();
const
ScopeLock
protect
(
mutex
);
bool
result
=
IsStarting
();
return
IsStarting
();
Unlock
();
return
result
;
}
}
bool
HasFailed
()
const
{
bool
HasFailed
()
const
{
...
@@ -239,10 +235,8 @@ struct DecoderControl {
...
@@ -239,10 +235,8 @@ struct DecoderControl {
gcc_pure
gcc_pure
bool
LockHasFailed
()
const
{
bool
LockHasFailed
()
const
{
Lock
();
const
ScopeLock
protect
(
mutex
);
bool
result
=
HasFailed
();
return
HasFailed
();
Unlock
();
return
result
;
}
}
/**
/**
...
@@ -267,10 +261,8 @@ struct DecoderControl {
...
@@ -267,10 +261,8 @@ struct DecoderControl {
*/
*/
gcc_pure
gcc_pure
Error
LockGetError
()
const
{
Error
LockGetError
()
const
{
Lock
();
const
ScopeLock
protect
(
mutex
);
Error
result
=
GetError
();
return
GetError
();
Unlock
();
return
result
;
}
}
/**
/**
...
@@ -297,10 +289,8 @@ struct DecoderControl {
...
@@ -297,10 +289,8 @@ struct DecoderControl {
gcc_pure
gcc_pure
bool
LockIsCurrentSong
(
const
DetachedSong
&
_song
)
const
{
bool
LockIsCurrentSong
(
const
DetachedSong
&
_song
)
const
{
Lock
();
const
ScopeLock
protect
(
mutex
);
const
bool
result
=
IsCurrentSong
(
_song
);
return
IsCurrentSong
(
_song
);
Unlock
();
return
result
;
}
}
private
:
private
:
...
@@ -336,17 +326,15 @@ private:
...
@@ -336,17 +326,15 @@ private:
* object.
* object.
*/
*/
void
LockSynchronousCommand
(
DecoderCommand
cmd
)
{
void
LockSynchronousCommand
(
DecoderCommand
cmd
)
{
Lock
(
);
const
ScopeLock
protect
(
mutex
);
ClearError
();
ClearError
();
SynchronousCommandLocked
(
cmd
);
SynchronousCommandLocked
(
cmd
);
Unlock
();
}
}
void
LockAsynchronousCommand
(
DecoderCommand
cmd
)
{
void
LockAsynchronousCommand
(
DecoderCommand
cmd
)
{
Lock
(
);
const
ScopeLock
protect
(
mutex
);
command
=
cmd
;
command
=
cmd
;
Signal
();
Signal
();
Unlock
();
}
}
public
:
public
:
...
...
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