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
4ee8396f
Commit
4ee8396f
authored
Apr 12, 2008
by
Max Kellermann
Committed by
Eric Wong
Apr 12, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use the notify API in the main thread
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7283
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
b7ac3fab
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
9 deletions
+19
-9
main.c
src/main.c
+16
-0
player.c
src/player.c
+1
-9
player.h
src/player.h
+2
-0
No files found.
src/main.c
View file @
4ee8396f
...
...
@@ -56,6 +56,8 @@ typedef struct _Options {
int
verbose
;
}
Options
;
static
Notify
main_notify
;
/*
* from git-1.3.0, needed for solaris
*/
...
...
@@ -378,6 +380,16 @@ static void killFromPidFile(char *cmd, int killOption)
exit
(
EXIT_SUCCESS
);
}
void
wakeup_main_task
(
void
)
{
notifySignal
(
&
main_notify
);
}
void
wait_main_task
(
void
)
{
notifySignal
(
&
main_notify
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
Options
options
;
...
...
@@ -420,6 +432,8 @@ int main(int argc, char *argv[])
initNormalization
();
initInputStream
();
notifyInit
(
&
main_notify
);
daemonize
(
&
options
);
setup_log_output
(
options
.
stdOutput
);
...
...
@@ -433,6 +447,8 @@ int main(int argc, char *argv[])
playerInit
();
read_state_file
();
notifyEnter
(
&
main_notify
);
while
(
COMMAND_RETURN_KILL
!=
doIOForInterfaces
()
&&
COMMAND_RETURN_KILL
!=
handlePendingSignals
())
{
syncPlayerAndPlaylist
();
...
...
src/player.c
View file @
4ee8396f
...
...
@@ -33,9 +33,6 @@
#include "sig_handlers.h"
#include "os_compat.h"
static
pthread_cond_t
main_wakeup
=
PTHREAD_COND_INITIALIZER
;
static
pthread_mutex_t
main_wakeup_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
void
playerCloseAudio
(
void
);
void
wakeup_player_nb
(
void
)
...
...
@@ -48,12 +45,7 @@ static void wakeup_player(void)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
notifySignal
(
&
pc
->
notify
);
pthread_cond_wait
(
&
main_wakeup
,
&
main_wakeup_mutex
);
}
void
wakeup_main_task
(
void
)
{
pthread_cond_signal
(
&
main_wakeup
);
wait_main_task
();
}
void
player_sleep
(
void
)
...
...
src/player.h
View file @
4ee8396f
...
...
@@ -80,6 +80,8 @@ typedef struct _PlayerControl {
void
wakeup_main_task
(
void
);
void
wait_main_task
(
void
);
void
wakeup_player_nb
(
void
);
void
player_sleep
(
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