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
06e0741a
Commit
06e0741a
authored
Jan 10, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlayerControl: switch to the Mutex/Cond classes
parent
0b934453
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
13 deletions
+10
-13
PlayerControl.cxx
src/PlayerControl.cxx
+1
-6
PlayerControl.hxx
src/PlayerControl.hxx
+8
-6
PlayerThread.cxx
src/PlayerThread.cxx
+1
-1
No files found.
src/PlayerControl.cxx
View file @
06e0741a
...
...
@@ -37,8 +37,6 @@ player_control::player_control(unsigned _buffer_chunks,
:
buffer_chunks
(
_buffer_chunks
),
buffered_before_play
(
_buffered_before_play
),
thread
(
nullptr
),
mutex
(
g_mutex_new
()),
cond
(
g_cond_new
()),
command
(
PLAYER_COMMAND_NONE
),
state
(
PLAYER_STATE_STOP
),
error_type
(
PLAYER_ERROR_NONE
),
...
...
@@ -55,9 +53,6 @@ player_control::~player_control()
{
if
(
next_song
!=
nullptr
)
song_free
(
next_song
);
g_cond_free
(
cond
);
g_mutex_free
(
mutex
);
}
void
...
...
@@ -76,7 +71,7 @@ static void
player_command_wait_locked
(
struct
player_control
*
pc
)
{
while
(
pc
->
command
!=
PLAYER_COMMAND_NONE
)
g_cond_wait
(
pc
->
cond
,
pc
->
mutex
);
pc
->
cond
.
wait
(
pc
->
mutex
);
}
static
void
...
...
src/PlayerControl.hxx
View file @
06e0741a
...
...
@@ -21,6 +21,8 @@
#define MPD_PLAYER_H
#include "audio_format.h"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include <glib.h>
...
...
@@ -99,12 +101,12 @@ struct player_control {
/**
* This lock protects #command, #state, #error.
*/
GMutex
*
mutex
;
Mutex
mutex
;
/**
* Trigger this object after you have modified #command.
*/
GCond
*
cond
;
Cond
cond
;
enum
player_command
command
;
enum
player_state
state
;
...
...
@@ -158,7 +160,7 @@ struct player_control {
static
inline
void
player_lock
(
struct
player_control
*
pc
)
{
g_mutex_lock
(
pc
->
mutex
);
pc
->
mutex
.
lock
(
);
}
/**
...
...
@@ -167,7 +169,7 @@ player_lock(struct player_control *pc)
static
inline
void
player_unlock
(
struct
player_control
*
pc
)
{
g_mutex_unlock
(
pc
->
mutex
);
pc
->
mutex
.
unlock
(
);
}
/**
...
...
@@ -178,7 +180,7 @@ player_unlock(struct player_control *pc)
static
inline
void
player_wait
(
struct
player_control
*
pc
)
{
g_cond_wait
(
pc
->
cond
,
pc
->
mutex
);
pc
->
cond
.
wait
(
pc
->
mutex
);
}
/**
...
...
@@ -198,7 +200,7 @@ player_wait_decoder(struct player_control *pc, struct decoder_control *dc);
static
inline
void
player_signal
(
struct
player_control
*
pc
)
{
g_cond_signal
(
pc
->
cond
);
pc
->
cond
.
signal
(
);
}
/**
...
...
src/PlayerThread.cxx
View file @
06e0741a
...
...
@@ -147,7 +147,7 @@ player_command_finished_locked(struct player_control *pc)
assert
(
pc
->
command
!=
PLAYER_COMMAND_NONE
);
pc
->
command
=
PLAYER_COMMAND_NONE
;
g_cond_signal
(
pc
->
cond
);
pc
->
cond
.
signal
(
);
}
static
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