notify: don't use camelCase in notify.[ch]
git-svn-id: https://svn.musicpd.org/mpd/trunk@7367 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
e0be3aad20
commit
97698bd4aa
@ -40,19 +40,19 @@ void decoder_wakeup_player(void)
|
|||||||
|
|
||||||
void decoder_sleep(void)
|
void decoder_sleep(void)
|
||||||
{
|
{
|
||||||
notifyWait(&dc.notify);
|
notify_wait(&dc.notify);
|
||||||
wakeup_player_nb();
|
wakeup_player_nb();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void player_wakeup_decoder_nb(void)
|
static void player_wakeup_decoder_nb(void)
|
||||||
{
|
{
|
||||||
notifySignal(&dc.notify);
|
notify_signal(&dc.notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called from player_task */
|
/* called from player_task */
|
||||||
static void player_wakeup_decoder(void)
|
static void player_wakeup_decoder(void)
|
||||||
{
|
{
|
||||||
notifySignal(&dc.notify);
|
notify_signal(&dc.notify);
|
||||||
player_sleep();
|
player_sleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ stop_no_close:
|
|||||||
|
|
||||||
static void * decoder_task(mpd_unused void *arg)
|
static void * decoder_task(mpd_unused void *arg)
|
||||||
{
|
{
|
||||||
notifyEnter(&dc.notify);
|
notify_enter(&dc.notify);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
assert(dc.state == DECODE_STATE_STOP);
|
assert(dc.state == DECODE_STATE_STOP);
|
||||||
|
14
src/notify.c
14
src/notify.c
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "notify.h"
|
#include "notify.h"
|
||||||
|
|
||||||
int notifyInit(Notify *notify)
|
int notify_init(Notify *notify)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -37,32 +37,32 @@ int notifyInit(Notify *notify)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifyEnter(Notify *notify)
|
void notify_enter(Notify *notify)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(¬ify->mutex);
|
pthread_mutex_lock(¬ify->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifyLeave(Notify *notify)
|
void notify_leave(Notify *notify)
|
||||||
{
|
{
|
||||||
pthread_mutex_unlock(¬ify->mutex);
|
pthread_mutex_unlock(¬ify->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifyWait(Notify *notify)
|
void notify_wait(Notify *notify)
|
||||||
{
|
{
|
||||||
if (!notify->pending)
|
if (!notify->pending)
|
||||||
pthread_cond_wait(¬ify->cond, ¬ify->mutex);
|
pthread_cond_wait(¬ify->cond, ¬ify->mutex);
|
||||||
notify->pending = 0;
|
notify->pending = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifySignal(Notify *notify)
|
void notify_signal(Notify *notify)
|
||||||
{
|
{
|
||||||
notify->pending = 1;
|
notify->pending = 1;
|
||||||
pthread_cond_signal(¬ify->cond);
|
pthread_cond_signal(¬ify->cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
void notifySignalSync(Notify *notify)
|
void notify_signal_sync(Notify *notify)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(¬ify->mutex);
|
pthread_mutex_lock(¬ify->mutex);
|
||||||
notifySignal(notify);
|
notify_signal(notify);
|
||||||
pthread_mutex_unlock(¬ify->mutex);
|
pthread_mutex_unlock(¬ify->mutex);
|
||||||
}
|
}
|
||||||
|
18
src/notify.h
18
src/notify.h
@ -27,34 +27,34 @@ typedef struct _Notify {
|
|||||||
int pending;
|
int pending;
|
||||||
} Notify;
|
} Notify;
|
||||||
|
|
||||||
int notifyInit(Notify *notify);
|
int notify_init(Notify *notify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The thread which shall be notified by this object must call this
|
* The thread which shall be notified by this object must call this
|
||||||
* function before any notifyWait() invocation. It locks the mutex.
|
* function before any notify_wait() invocation. It locks the mutex.
|
||||||
*/
|
*/
|
||||||
void notifyEnter(Notify *notify);
|
void notify_enter(Notify *notify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Neutralize notifyLeave().
|
* Neutralize notify_leave().
|
||||||
*/
|
*/
|
||||||
void notifyLeave(Notify *notify);
|
void notify_leave(Notify *notify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for a notification. Return immediately if we have already
|
* Wait for a notification. Return immediately if we have already
|
||||||
* been notified since we last returned from notifyWait().
|
* been notified since we last returned from notify_wait().
|
||||||
*/
|
*/
|
||||||
void notifyWait(Notify *notify);
|
void notify_wait(Notify *notify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the thread. This function never blocks.
|
* Notify the thread. This function never blocks.
|
||||||
*/
|
*/
|
||||||
void notifySignal(Notify *notify);
|
void notify_signal(Notify *notify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the thread synchonously, i.e. wait until it has received the
|
* Notify the thread synchonously, i.e. wait until it has received the
|
||||||
* notification.
|
* notification.
|
||||||
*/
|
*/
|
||||||
void notifySignalSync(Notify *notify);
|
void notify_signal_sync(Notify *notify);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,23 +38,23 @@ static void playerCloseAudio(void);
|
|||||||
|
|
||||||
void wakeup_player_nb(void)
|
void wakeup_player_nb(void)
|
||||||
{
|
{
|
||||||
notifySignal(&pc.notify);
|
notify_signal(&pc.notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wakeup_player(void)
|
static void wakeup_player(void)
|
||||||
{
|
{
|
||||||
notifySignal(&pc.notify);
|
notify_signal(&pc.notify);
|
||||||
wait_main_task();
|
wait_main_task();
|
||||||
}
|
}
|
||||||
|
|
||||||
void player_sleep(void)
|
void player_sleep(void)
|
||||||
{
|
{
|
||||||
notifyWait(&pc.notify);
|
notify_wait(&pc.notify);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * player_task(mpd_unused void *arg)
|
static void * player_task(mpd_unused void *arg)
|
||||||
{
|
{
|
||||||
notifyEnter(&pc.notify);
|
notify_enter(&pc.notify);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (pc.play) {
|
if (pc.play) {
|
||||||
|
@ -79,7 +79,7 @@ void initPlayerData(void)
|
|||||||
|
|
||||||
ob_init(buffered_chunks);
|
ob_init(buffered_chunks);
|
||||||
|
|
||||||
notifyInit(&pc.notify);
|
notify_init(&pc.notify);
|
||||||
pc.error = PLAYER_ERROR_NOERROR;
|
pc.error = PLAYER_ERROR_NOERROR;
|
||||||
pc.state = PLAYER_STATE_STOP;
|
pc.state = PLAYER_STATE_STOP;
|
||||||
pc.queueState = PLAYER_QUEUE_BLANK;
|
pc.queueState = PLAYER_QUEUE_BLANK;
|
||||||
@ -87,7 +87,7 @@ void initPlayerData(void)
|
|||||||
pc.crossFade = crossfade;
|
pc.crossFade = crossfade;
|
||||||
pc.softwareVolume = 1000;
|
pc.softwareVolume = 1000;
|
||||||
|
|
||||||
notifyInit(&dc.notify);
|
notify_init(&dc.notify);
|
||||||
dc.state = DECODE_STATE_STOP;
|
dc.state = DECODE_STATE_STOP;
|
||||||
dc.error = DECODE_ERROR_NOERROR;
|
dc.error = DECODE_ERROR_NOERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user