diff options
author | Max Kellermann <max@duempel.org> | 2013-01-10 10:44:04 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-10 10:44:04 +0100 |
commit | b8cda53bd36809b6f61c2e42a673dfdcd43f0c1d (patch) | |
tree | 297e3f5d87d2304a7311549399d1896d377d0099 /src/notify.hxx | |
parent | e0a97a030fc4c6f978b2855c32f5da98b3e7fb78 (diff) | |
download | mpd-b8cda53bd36809b6f61c2e42a673dfdcd43f0c1d.tar.gz mpd-b8cda53bd36809b6f61c2e42a673dfdcd43f0c1d.tar.xz mpd-b8cda53bd36809b6f61c2e42a673dfdcd43f0c1d.zip |
notify: convert to C++
Diffstat (limited to '')
-rw-r--r-- | src/notify.hxx (renamed from src/notify.h) | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/notify.h b/src/notify.hxx index 40821690c..6b9e95368 100644 --- a/src/notify.h +++ b/src/notify.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2011 The Music Player Daemon Project + * Copyright (C) 2003-2013 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -17,37 +17,37 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_NOTIFY_H -#define MPD_NOTIFY_H +#ifndef MPD_NOTIFY_HXX +#define MPD_NOTIFY_HXX -#include <glib.h> - -#include <stdbool.h> +#include "thread/Mutex.hxx" +#include "thread/Cond.hxx" struct notify { - GMutex *mutex; - GCond *cond; + Mutex mutex; + Cond cond; bool pending; -}; - -void notify_init(struct notify *notify); - -void notify_deinit(struct notify *notify); - -/** - * Wait for a notification. Return immediately if we have already - * been notified since we last returned from notify_wait(). - */ -void notify_wait(struct notify *notify); -/** - * Notify the thread. This function never blocks. - */ -void notify_signal(struct notify *notify); - -/** - * Clears a pending notification. - */ -void notify_clear(struct notify *notify); +#ifndef WIN32 + constexpr +#endif + notify():pending(false) {} + + /** + * Wait for a notification. Return immediately if we have already + * been notified since we last returned from notify_wait(). + */ + void Wait(); + + /** + * Notify the thread. This function never blocks. + */ + void Signal(); + + /** + * Clears a pending notification. + */ + void Clear(); +}; #endif |