notify: declare "struct notify"
"struct notify" is the same as the "Notify" typedef. It can be forward-declared and has a lower case name.
This commit is contained in:
12
src/notify.c
12
src/notify.c
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "notify.h"
|
||||
|
||||
int notify_init(Notify *notify)
|
||||
int notify_init(struct notify *notify)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -37,30 +37,30 @@ int notify_init(Notify *notify)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void notify_enter(Notify *notify)
|
||||
void notify_enter(struct notify *notify)
|
||||
{
|
||||
pthread_mutex_lock(¬ify->mutex);
|
||||
}
|
||||
|
||||
void notify_leave(Notify *notify)
|
||||
void notify_leave(struct notify *notify)
|
||||
{
|
||||
pthread_mutex_unlock(¬ify->mutex);
|
||||
}
|
||||
|
||||
void notify_wait(Notify *notify)
|
||||
void notify_wait(struct notify *notify)
|
||||
{
|
||||
if (!notify->pending)
|
||||
pthread_cond_wait(¬ify->cond, ¬ify->mutex);
|
||||
notify->pending = 0;
|
||||
}
|
||||
|
||||
void notify_signal(Notify *notify)
|
||||
void notify_signal(struct notify *notify)
|
||||
{
|
||||
notify->pending = 1;
|
||||
pthread_cond_signal(¬ify->cond);
|
||||
}
|
||||
|
||||
void notify_signal_sync(Notify *notify)
|
||||
void notify_signal_sync(struct notify *notify)
|
||||
{
|
||||
pthread_mutex_lock(¬ify->mutex);
|
||||
notify_signal(notify);
|
||||
|
||||
Reference in New Issue
Block a user