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
60f809b3
Commit
60f809b3
authored
Jan 04, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: use notify.h instead of condition.h
The notify library is easier to use, and has no disadvantages.
parent
21173ea4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
update.c
src/update.c
+10
-12
No files found.
src/update.c
View file @
60f809b3
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
#include "decoder_list.h"
#include "decoder_list.h"
#include "playlist.h"
#include "playlist.h"
#include "event_pipe.h"
#include "event_pipe.h"
#include "
condition
.h"
#include "
notify
.h"
#include "update.h"
#include "update.h"
#include "idle.h"
#include "idle.h"
#include "conf.h"
#include "conf.h"
...
@@ -69,7 +69,8 @@ static unsigned update_task_id;
...
@@ -69,7 +69,8 @@ static unsigned update_task_id;
static
struct
song
*
delete
;
static
struct
song
*
delete
;
static
struct
condition
delete_cond
;
/** used by the main thread to notify the update thread */
static
struct
notify
update_notify
;
#ifndef WIN32
#ifndef WIN32
...
@@ -104,12 +105,13 @@ delete_song(struct directory *dir, struct song *del)
...
@@ -104,12 +105,13 @@ delete_song(struct directory *dir, struct song *del)
songvec_delete
(
&
dir
->
songs
,
del
);
songvec_delete
(
&
dir
->
songs
,
del
);
/* now take it out of the playlist (in the main_task) */
/* now take it out of the playlist (in the main_task) */
cond_enter
(
&
delete_cond
);
assert
(
!
delete
);
assert
(
!
delete
);
delete
=
del
;
delete
=
del
;
event_pipe_emit
(
PIPE_EVENT_DELETE
);
event_pipe_emit
(
PIPE_EVENT_DELETE
);
do
{
cond_wait
(
&
delete_cond
);
}
while
(
delete
);
cond_leave
(
&
delete_cond
);
do
{
notify_wait
(
&
update_notify
);
}
while
(
delete
!=
NULL
);
/* finally, all possible references gone, free it */
/* finally, all possible references gone, free it */
song_free
(
del
);
song_free
(
del
);
...
@@ -703,8 +705,6 @@ static void song_delete_event(void)
...
@@ -703,8 +705,6 @@ static void song_delete_event(void)
assert
(
progress
==
UPDATE_PROGRESS_RUNNING
);
assert
(
progress
==
UPDATE_PROGRESS_RUNNING
);
assert
(
delete
!=
NULL
);
assert
(
delete
!=
NULL
);
cond_enter
(
&
delete_cond
);
uri
=
song_get_uri
(
delete
);
uri
=
song_get_uri
(
delete
);
g_debug
(
"removing: %s"
,
uri
);
g_debug
(
"removing: %s"
,
uri
);
g_free
(
uri
);
g_free
(
uri
);
...
@@ -712,9 +712,7 @@ static void song_delete_event(void)
...
@@ -712,9 +712,7 @@ static void song_delete_event(void)
deleteASongFromPlaylist
(
delete
);
deleteASongFromPlaylist
(
delete
);
delete
=
NULL
;
delete
=
NULL
;
cond_signal_sync
(
&
delete_cond
);
notify_signal
(
&
update_notify
);
cond_leave
(
&
delete_cond
);
}
}
/**
/**
...
@@ -758,7 +756,7 @@ void update_global_init(void)
...
@@ -758,7 +756,7 @@ void update_global_init(void)
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
);
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
);
#endif
#endif
cond_init
(
&
delete_cond
);
notify_init
(
&
update_notify
);
event_pipe_register
(
PIPE_EVENT_DELETE
,
song_delete_event
);
event_pipe_register
(
PIPE_EVENT_DELETE
,
song_delete_event
);
event_pipe_register
(
PIPE_EVENT_UPDATE
,
update_finished_event
);
event_pipe_register
(
PIPE_EVENT_UPDATE
,
update_finished_event
);
...
@@ -766,5 +764,5 @@ void update_global_init(void)
...
@@ -766,5 +764,5 @@ void update_global_init(void)
void
update_global_finish
(
void
)
void
update_global_finish
(
void
)
{
{
cond_destroy
(
&
delete_cond
);
notify_deinit
(
&
update_notify
);
}
}
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