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
22bb5a58
Commit
22bb5a58
authored
Jan 01, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event_pipe: renamed functions from main_notify_* to event_pipe_*
Continuing the previous patch.
parent
9f5934d9
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
27 deletions
+27
-27
database.c
src/database.c
+1
-1
event_pipe.c
src/event_pipe.c
+12
-12
event_pipe.h
src/event_pipe.h
+4
-4
idle.c
src/idle.c
+1
-1
main.c
src/main.c
+2
-2
player_control.c
src/player_control.c
+1
-1
player_thread.c
src/player_thread.c
+4
-4
update.c
src/update.c
+2
-2
No files found.
src/database.c
View file @
22bb5a58
...
@@ -58,7 +58,7 @@ db_init(void)
...
@@ -58,7 +58,7 @@ db_init(void)
g_error
(
"directory update failed"
);
g_error
(
"directory update failed"
);
do
{
do
{
wait_main_task
();
event_pipe_wait
();
reap_update_task
();
reap_update_task
();
}
while
(
isUpdatingDB
());
}
while
(
isUpdatingDB
());
...
...
src/event_pipe.c
View file @
22bb5a58
...
@@ -26,13 +26,13 @@
...
@@ -26,13 +26,13 @@
#include <glib.h>
#include <glib.h>
#include <string.h>
#include <string.h>
static
int
main_pipe
[
2
];
GThread
*
main_task
;
GThread
*
main_task
;
static
int
event_pipe
[
2
];
static
void
consume_pipe
(
void
)
static
void
consume_pipe
(
void
)
{
{
char
buffer
[
256
];
char
buffer
[
256
];
ssize_t
r
=
read
(
main
_pipe
[
0
],
buffer
,
sizeof
(
buffer
));
ssize_t
r
=
read
(
event
_pipe
[
0
],
buffer
,
sizeof
(
buffer
));
if
(
r
<
0
&&
errno
!=
EAGAIN
&&
errno
!=
EINTR
)
if
(
r
<
0
&&
errno
!=
EAGAIN
&&
errno
!=
EINTR
)
FATAL
(
"error reading from pipe: %s
\n
"
,
strerror
(
errno
));
FATAL
(
"error reading from pipe: %s
\n
"
,
strerror
(
errno
));
...
@@ -48,38 +48,38 @@ main_notify_event(G_GNUC_UNUSED GIOChannel *source,
...
@@ -48,38 +48,38 @@ main_notify_event(G_GNUC_UNUSED GIOChannel *source,
return
true
;
return
true
;
}
}
void
init_main_notify
(
void
)
void
event_pipe_init
(
void
)
{
{
GIOChannel
*
channel
;
GIOChannel
*
channel
;
main_task
=
g_thread_self
();
main_task
=
g_thread_self
();
if
(
pipe
(
main
_pipe
)
<
0
)
if
(
pipe
(
event
_pipe
)
<
0
)
g_error
(
"Couldn't open pipe: %s"
,
strerror
(
errno
));
g_error
(
"Couldn't open pipe: %s"
,
strerror
(
errno
));
if
(
set_nonblocking
(
main
_pipe
[
1
])
<
0
)
if
(
set_nonblocking
(
event
_pipe
[
1
])
<
0
)
g_error
(
"Couldn't set non-blocking I/O: %s"
,
strerror
(
errno
));
g_error
(
"Couldn't set non-blocking I/O: %s"
,
strerror
(
errno
));
channel
=
g_io_channel_unix_new
(
main
_pipe
[
0
]);
channel
=
g_io_channel_unix_new
(
event
_pipe
[
0
]);
g_io_add_watch
(
channel
,
G_IO_IN
,
main_notify_event
,
NULL
);
g_io_add_watch
(
channel
,
G_IO_IN
,
main_notify_event
,
NULL
);
g_io_channel_unref
(
channel
);
g_io_channel_unref
(
channel
);
main_task
=
g_thread_self
();
main_task
=
g_thread_self
();
}
}
void
deinit_main_notify
(
void
)
void
event_pipe_deinit
(
void
)
{
{
xclose
(
main
_pipe
[
0
]);
xclose
(
event
_pipe
[
0
]);
xclose
(
main
_pipe
[
1
]);
xclose
(
event
_pipe
[
1
]);
}
}
void
wakeup_main_task
(
void
)
void
event_pipe_signal
(
void
)
{
{
ssize_t
w
=
write
(
main
_pipe
[
1
],
""
,
1
);
ssize_t
w
=
write
(
event
_pipe
[
1
],
""
,
1
);
if
(
w
<
0
&&
errno
!=
EAGAIN
&&
errno
!=
EINTR
)
if
(
w
<
0
&&
errno
!=
EAGAIN
&&
errno
!=
EINTR
)
g_error
(
"error writing to pipe: %s"
,
strerror
(
errno
));
g_error
(
"error writing to pipe: %s"
,
strerror
(
errno
));
}
}
void
wait_main_task
(
void
)
void
event_pipe_wait
(
void
)
{
{
consume_pipe
();
consume_pipe
();
}
}
src/event_pipe.h
View file @
22bb5a58
...
@@ -25,13 +25,13 @@
...
@@ -25,13 +25,13 @@
extern
GThread
*
main_task
;
extern
GThread
*
main_task
;
void
init_main_notify
(
void
);
void
event_pipe_init
(
void
);
void
deinit_main_notify
(
void
);
void
event_pipe_deinit
(
void
);
void
wakeup_main_task
(
void
);
void
event_pipe_signal
(
void
);
void
wait_main_task
(
void
);
void
event_pipe_wait
(
void
);
void
void
main_notify_triggered
(
void
);
main_notify_triggered
(
void
);
...
...
src/idle.c
View file @
22bb5a58
...
@@ -66,7 +66,7 @@ idle_add(unsigned flags)
...
@@ -66,7 +66,7 @@ idle_add(unsigned flags)
idle_flags
|=
flags
;
idle_flags
|=
flags
;
g_mutex_unlock
(
idle_mutex
);
g_mutex_unlock
(
idle_mutex
);
wakeup_main_task
();
event_pipe_signal
();
}
}
unsigned
unsigned
...
...
src/main.c
View file @
22bb5a58
...
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
...
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
decoder_plugin_init_all
();
decoder_plugin_init_all
();
update_global_init
();
update_global_init
();
init_main_notify
();
event_pipe_init
();
openDB
(
&
options
,
argv
[
0
]);
openDB
(
&
options
,
argv
[
0
]);
...
@@ -308,7 +308,7 @@ int main(int argc, char *argv[])
...
@@ -308,7 +308,7 @@ int main(int argc, char *argv[])
g_debug
(
"db_finish took %f seconds"
,
g_debug
(
"db_finish took %f seconds"
,
((
float
)(
clock
()
-
start
))
/
CLOCKS_PER_SEC
);
((
float
)(
clock
()
-
start
))
/
CLOCKS_PER_SEC
);
deinit_main_notify
();
event_pipe_deinit
();
input_stream_global_finish
();
input_stream_global_finish
();
finishNormalization
();
finishNormalization
();
...
...
src/player_control.c
View file @
22bb5a58
...
@@ -58,7 +58,7 @@ static void player_command(enum player_command cmd)
...
@@ -58,7 +58,7 @@ static void player_command(enum player_command cmd)
pc
.
command
=
cmd
;
pc
.
command
=
cmd
;
while
(
pc
.
command
!=
PLAYER_COMMAND_NONE
)
{
while
(
pc
.
command
!=
PLAYER_COMMAND_NONE
)
{
notify_signal
(
&
pc
.
notify
);
notify_signal
(
&
pc
.
notify
);
wait_main_task
();
event_pipe_wait
();
}
}
}
}
...
...
src/player_thread.c
View file @
22bb5a58
...
@@ -83,14 +83,14 @@ static void player_command_finished(void)
...
@@ -83,14 +83,14 @@ static void player_command_finished(void)
assert
(
pc
.
command
!=
PLAYER_COMMAND_NONE
);
assert
(
pc
.
command
!=
PLAYER_COMMAND_NONE
);
pc
.
command
=
PLAYER_COMMAND_NONE
;
pc
.
command
=
PLAYER_COMMAND_NONE
;
wakeup_main_task
();
event_pipe_signal
();
}
}
static
void
player_stop_decoder
(
void
)
static
void
player_stop_decoder
(
void
)
{
{
dc_stop
(
&
pc
.
notify
);
dc_stop
(
&
pc
.
notify
);
pc
.
state
=
PLAYER_STATE_STOP
;
pc
.
state
=
PLAYER_STATE_STOP
;
wakeup_main_task
();
event_pipe_signal
();
}
}
static
int
player_wait_for_decoder
(
struct
player
*
player
)
static
int
player_wait_for_decoder
(
struct
player
*
player
)
...
@@ -369,7 +369,7 @@ static void do_play(void)
...
@@ -369,7 +369,7 @@ static void do_play(void)
request the next song from the playlist */
request the next song from the playlist */
pc
.
next_song
=
NULL
;
pc
.
next_song
=
NULL
;
wakeup_main_task
();
event_pipe_signal
();
}
}
if
(
decoder_is_idle
()
&&
player
.
queued
)
{
if
(
decoder_is_idle
()
&&
player
.
queued
)
{
...
@@ -476,7 +476,7 @@ static void do_play(void)
...
@@ -476,7 +476,7 @@ static void do_play(void)
if
(
player_wait_for_decoder
(
&
player
)
<
0
)
if
(
player_wait_for_decoder
(
&
player
)
<
0
)
return
;
return
;
wakeup_main_task
();
event_pipe_signal
();
}
else
if
(
decoder_is_idle
())
{
}
else
if
(
decoder_is_idle
())
{
break
;
break
;
}
else
{
}
else
{
...
...
src/update.c
View file @
22bb5a58
...
@@ -98,7 +98,7 @@ delete_song(struct directory *dir, struct song *del)
...
@@ -98,7 +98,7 @@ delete_song(struct directory *dir, struct song *del)
cond_enter
(
&
delete_cond
);
cond_enter
(
&
delete_cond
);
assert
(
!
delete
);
assert
(
!
delete
);
delete
=
del
;
delete
=
del
;
wakeup_main_task
();
event_pipe_signal
();
do
{
cond_wait
(
&
delete_cond
);
}
while
(
delete
);
do
{
cond_wait
(
&
delete_cond
);
}
while
(
delete
);
cond_leave
(
&
delete_cond
);
cond_leave
(
&
delete_cond
);
...
@@ -603,7 +603,7 @@ static void * update_task(void *_path)
...
@@ -603,7 +603,7 @@ static void * update_task(void *_path)
if
(
modified
)
if
(
modified
)
db_save
();
db_save
();
progress
=
UPDATE_PROGRESS_DONE
;
progress
=
UPDATE_PROGRESS_DONE
;
wakeup_main_task
();
event_pipe_signal
();
return
NULL
;
return
NULL
;
}
}
...
...
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