notify: added notify_deinit()
Destroy the mutex when it is not used anymore.
This commit is contained in:
parent
ee1d723ad7
commit
a0272c2d61
|
@ -28,6 +28,11 @@ void dc_init(void)
|
|||
dc.error = DECODE_ERROR_NOERROR;
|
||||
}
|
||||
|
||||
void dc_deinit(void)
|
||||
{
|
||||
notify_deinit(&dc.notify);
|
||||
}
|
||||
|
||||
void dc_command_wait(Notify *notify)
|
||||
{
|
||||
while (dc.command != DECODE_COMMAND_NONE) {
|
||||
|
|
|
@ -58,6 +58,8 @@ extern struct decoder_control dc;
|
|||
|
||||
void dc_init(void);
|
||||
|
||||
void dc_deinit(void);
|
||||
|
||||
static inline int decoder_is_idle(void)
|
||||
{
|
||||
return dc.state == DECODE_STATE_STOP &&
|
||||
|
|
|
@ -459,12 +459,16 @@ int main(int argc, char *argv[])
|
|||
DEBUG("closeMp3Directory took %f seconds\n",
|
||||
((float)(clock()-start))/CLOCKS_PER_SEC);
|
||||
|
||||
deinit_main_notify();
|
||||
|
||||
finishNormalization();
|
||||
finishAudioDriver();
|
||||
finishAudioConfig();
|
||||
finishVolume();
|
||||
finishPaths();
|
||||
finishPermissions();
|
||||
dc_deinit();
|
||||
pc_deinit();
|
||||
finishCommands();
|
||||
decoder_plugin_deinit_all();
|
||||
ob_free();
|
||||
|
|
|
@ -68,6 +68,14 @@ void init_main_notify(void)
|
|||
notify_init(&main_notify);
|
||||
}
|
||||
|
||||
void deinit_main_notify(void)
|
||||
{
|
||||
notify_deinit(&main_notify);
|
||||
deregisterIO(&main_notify_IO);
|
||||
xclose(main_pipe[0]);
|
||||
xclose(main_pipe[1]);
|
||||
}
|
||||
|
||||
static int wakeup_via_pipe(void)
|
||||
{
|
||||
int ret = pthread_mutex_trylock(&select_mutex);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
void init_main_notify(void);
|
||||
|
||||
void deinit_main_notify(void);
|
||||
|
||||
void wakeup_main_task(void);
|
||||
|
||||
void wait_main_task(void);
|
||||
|
|
|
@ -34,6 +34,12 @@ void notify_init(struct notify *notify)
|
|||
notify->pending = 0;
|
||||
}
|
||||
|
||||
void notify_deinit(struct notify *notify)
|
||||
{
|
||||
pthread_mutex_destroy(¬ify->mutex);
|
||||
pthread_cond_destroy(¬ify->cond);
|
||||
}
|
||||
|
||||
void notify_enter(struct notify *notify)
|
||||
{
|
||||
pthread_mutex_lock(¬ify->mutex);
|
||||
|
|
|
@ -29,6 +29,8 @@ typedef struct notify {
|
|||
|
||||
void notify_init(struct notify *notify);
|
||||
|
||||
void notify_deinit(struct notify *notify);
|
||||
|
||||
/**
|
||||
* The thread which shall be notified by this object must call this
|
||||
* function before any notify_wait() invocation. It locks the mutex.
|
||||
|
|
|
@ -38,6 +38,11 @@ void pc_init(unsigned int buffered_before_play)
|
|||
pc.softwareVolume = 1000;
|
||||
}
|
||||
|
||||
void pc_deinit(void)
|
||||
{
|
||||
notify_deinit(&pc.notify);
|
||||
}
|
||||
|
||||
static void set_current_song(Song *song)
|
||||
{
|
||||
assert(song != NULL);
|
||||
|
|
|
@ -107,6 +107,8 @@ extern struct player_control pc;
|
|||
|
||||
void pc_init(unsigned int buffered_before_play);
|
||||
|
||||
void pc_deinit(void);
|
||||
|
||||
void playerPlay(Song * song);
|
||||
|
||||
void playerSetPause(int pause_flag);
|
||||
|
|
Loading…
Reference in New Issue