From 7c1cf617282c591dff85df164c178198a0ce7738 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Thu, 17 Oct 2013 10:06:31 +0200
Subject: [PATCH] thread/{Cond,Mutex}: use "class" instead of "typedef"

Allows forward-declaration.
---
 src/ArchiveFile.hxx      | 2 ++
 src/ArchivePlugin.hxx    | 3 ---
 src/InputInternal.cxx    | 1 +
 src/InputStream.hxx      | 2 +-
 src/PlaylistAny.hxx      | 5 ++---
 src/PlaylistMapper.hxx   | 5 ++---
 src/PlaylistPlugin.hxx   | 5 ++---
 src/PlaylistPrint.cxx    | 1 +
 src/PlaylistQueue.cxx    | 1 +
 src/PlaylistRegistry.hxx | 5 ++---
 src/SongUpdate.cxx       | 1 +
 src/TagFile.cxx          | 1 +
 src/thread/Cond.hxx      | 4 ++--
 src/thread/Mutex.hxx     | 5 ++---
 test/dump_playlist.cxx   | 1 +
 test/dump_text_file.cxx  | 1 +
 test/read_tags.cxx       | 1 +
 test/run_decoder.cxx     | 1 +
 test/run_input.cxx       | 1 +
 19 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/src/ArchiveFile.hxx b/src/ArchiveFile.hxx
index de0ecc1e8..5f8dc54f5 100644
--- a/src/ArchiveFile.hxx
+++ b/src/ArchiveFile.hxx
@@ -20,6 +20,8 @@
 #ifndef MPD_ARCHIVE_FILE_HXX
 #define MPD_ARCHIVE_FILE_HXX
 
+class Mutex;
+class Cond;
 class Error;
 
 class ArchiveFile {
diff --git a/src/ArchivePlugin.hxx b/src/ArchivePlugin.hxx
index ac8c1c8e3..38b7bccc3 100644
--- a/src/ArchivePlugin.hxx
+++ b/src/ArchivePlugin.hxx
@@ -20,9 +20,6 @@
 #ifndef MPD_ARCHIVE_PLUGIN_HXX
 #define MPD_ARCHIVE_PLUGIN_HXX
 
-#include "thread/Mutex.hxx"
-#include "thread/Cond.hxx"
-
 struct input_stream;
 class ArchiveFile;
 class ArchiveVisitor;
diff --git a/src/InputInternal.cxx b/src/InputInternal.cxx
index e110ebf0a..93a8b9b51 100644
--- a/src/InputInternal.cxx
+++ b/src/InputInternal.cxx
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "InputInternal.hxx"
 #include "InputStream.hxx"
+#include "thread/Cond.hxx"
 
 void
 input_stream_signal_client(struct input_stream *is)
diff --git a/src/InputStream.hxx b/src/InputStream.hxx
index 2addd1a09..aee2bc426 100644
--- a/src/InputStream.hxx
+++ b/src/InputStream.hxx
@@ -22,7 +22,6 @@
 
 #include "check.h"
 #include "thread/Mutex.hxx"
-#include "thread/Cond.hxx"
 #include "Compiler.h"
 
 #include <string>
@@ -31,6 +30,7 @@
 
 #include <assert.h>
 
+class Cond;
 class Error;
 struct Tag;
 
diff --git a/src/PlaylistAny.hxx b/src/PlaylistAny.hxx
index 951fa1099..898057cdd 100644
--- a/src/PlaylistAny.hxx
+++ b/src/PlaylistAny.hxx
@@ -20,9 +20,8 @@
 #ifndef MPD_PLAYLIST_ANY_HXX
 #define MPD_PLAYLIST_ANY_HXX
 
-#include "thread/Mutex.hxx"
-#include "thread/Cond.hxx"
-
+class Mutex;
+class Cond;
 class SongEnumerator;
 struct input_stream;
 
diff --git a/src/PlaylistMapper.hxx b/src/PlaylistMapper.hxx
index b966e6c39..69ed01d02 100644
--- a/src/PlaylistMapper.hxx
+++ b/src/PlaylistMapper.hxx
@@ -20,9 +20,8 @@
 #ifndef MPD_PLAYLIST_MAPPER_HXX
 #define MPD_PLAYLIST_MAPPER_HXX
 
-#include "thread/Mutex.hxx"
-#include "thread/Cond.hxx"
-
+class Mutex;
+class Cond;
 class SongEnumerator;
 struct input_stream;
 
diff --git a/src/PlaylistPlugin.hxx b/src/PlaylistPlugin.hxx
index ce380d886..af2ceac47 100644
--- a/src/PlaylistPlugin.hxx
+++ b/src/PlaylistPlugin.hxx
@@ -20,12 +20,11 @@
 #ifndef MPD_PLAYLIST_PLUGIN_HXX
 #define MPD_PLAYLIST_PLUGIN_HXX
 
-#include "thread/Mutex.hxx"
-#include "thread/Cond.hxx"
-
 struct config_param;
 struct input_stream;
 struct Tag;
+class Mutex;
+class Cond;
 class SongEnumerator;
 
 struct playlist_plugin {
diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx
index 981cdc82f..791a600c5 100644
--- a/src/PlaylistPrint.cxx
+++ b/src/PlaylistPrint.cxx
@@ -34,6 +34,7 @@
 #include "InputStream.hxx"
 #include "Song.hxx"
 #include "util/Error.hxx"
+#include "thread/Cond.hxx"
 
 void
 playlist_print_uris(Client *client, const struct playlist *playlist)
diff --git a/src/PlaylistQueue.cxx b/src/PlaylistQueue.cxx
index 2b9e346ea..183237b5f 100644
--- a/src/PlaylistQueue.cxx
+++ b/src/PlaylistQueue.cxx
@@ -26,6 +26,7 @@
 #include "InputStream.hxx"
 #include "SongEnumerator.hxx"
 #include "Song.hxx"
+#include "thread/Cond.hxx"
 
 enum playlist_result
 playlist_load_into_queue(const char *uri, SongEnumerator &e,
diff --git a/src/PlaylistRegistry.hxx b/src/PlaylistRegistry.hxx
index aa6c36b85..72cd7222f 100644
--- a/src/PlaylistRegistry.hxx
+++ b/src/PlaylistRegistry.hxx
@@ -20,9 +20,8 @@
 #ifndef MPD_PLAYLIST_REGISTRY_HXX
 #define MPD_PLAYLIST_REGISTRY_HXX
 
-#include "thread/Mutex.hxx"
-#include "thread/Cond.hxx"
-
+class Mutex;
+class Cond;
 class SongEnumerator;
 struct input_stream;
 
diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx
index b6e0acb60..ecee456ec 100644
--- a/src/SongUpdate.cxx
+++ b/src/SongUpdate.cxx
@@ -33,6 +33,7 @@
 #include "tag/TagHandler.hxx"
 #include "tag/TagId3.hxx"
 #include "tag/ApeTag.hxx"
+#include "thread/Cond.hxx"
 
 #include <assert.h>
 #include <sys/types.h>
diff --git a/src/TagFile.cxx b/src/TagFile.cxx
index d5ba40d9e..4f7284903 100644
--- a/src/TagFile.cxx
+++ b/src/TagFile.cxx
@@ -24,6 +24,7 @@
 #include "DecoderList.hxx"
 #include "DecoderPlugin.hxx"
 #include "InputStream.hxx"
+#include "thread/Cond.hxx"
 
 #include <assert.h>
 #include <unistd.h> /* for SEEK_SET */
diff --git a/src/thread/Cond.hxx b/src/thread/Cond.hxx
index bbaabddc2..ed663dc9d 100644
--- a/src/thread/Cond.hxx
+++ b/src/thread/Cond.hxx
@@ -25,12 +25,12 @@
 /* mingw-w64 4.6.3 lacks a std::cond implementation */
 
 #include "WindowsCond.hxx"
-typedef WindowsCond Cond;
+class Cond : public WindowsCond {};
 
 #else
 
 #include "PosixCond.hxx"
-typedef PosixCond Cond;
+class Cond : public PosixCond {};
 
 #endif
 
diff --git a/src/thread/Mutex.hxx b/src/thread/Mutex.hxx
index 675af74b1..4ed48c972 100644
--- a/src/thread/Mutex.hxx
+++ b/src/thread/Mutex.hxx
@@ -25,13 +25,12 @@
 /* mingw-w64 4.6.3 lacks a std::mutex implementation */
 
 #include "CriticalSection.hxx"
-typedef CriticalSection Mutex;
+class Mutex : public CriticalSection {};
 
 #else
 
 #include "PosixMutex.hxx"
-
-typedef PosixMutex Mutex;
+class Mutex : public PosixMutex {};
 
 #endif
 
diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx
index 2f6b3ed2a..90cbc4564 100644
--- a/test/dump_playlist.cxx
+++ b/test/dump_playlist.cxx
@@ -32,6 +32,7 @@
 #include "PlaylistPlugin.hxx"
 #include "fs/Path.hxx"
 #include "util/Error.hxx"
+#include "thread/Cond.hxx"
 #include "Log.hxx"
 
 #include <glib.h>
diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx
index 685f0fbb9..00281bd8b 100644
--- a/test/dump_text_file.cxx
+++ b/test/dump_text_file.cxx
@@ -25,6 +25,7 @@
 #include "stdbin.h"
 #include "TextInputStream.hxx"
 #include "util/Error.hxx"
+#include "thread/Cond.hxx"
 #include "Log.hxx"
 
 #ifdef ENABLE_ARCHIVE
diff --git a/test/read_tags.cxx b/test/read_tags.cxx
index b4e5b2bb0..f98de3d66 100644
--- a/test/read_tags.cxx
+++ b/test/read_tags.cxx
@@ -28,6 +28,7 @@
 #include "tag/TagId3.hxx"
 #include "tag/ApeTag.hxx"
 #include "util/Error.hxx"
+#include "thread/Cond.hxx"
 #include "Log.hxx"
 
 #include <glib.h>
diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx
index c2aa1d7d6..7efb9d906 100644
--- a/test/run_decoder.cxx
+++ b/test/run_decoder.cxx
@@ -25,6 +25,7 @@
 #include "InputStream.hxx"
 #include "AudioFormat.hxx"
 #include "util/Error.hxx"
+#include "thread/Cond.hxx"
 #include "Log.hxx"
 #include "stdbin.h"
 
diff --git a/test/run_input.cxx b/test/run_input.cxx
index d278676ce..042c7ddd0 100644
--- a/test/run_input.cxx
+++ b/test/run_input.cxx
@@ -26,6 +26,7 @@
 #include "InputInit.hxx"
 #include "IOThread.hxx"
 #include "util/Error.hxx"
+#include "thread/Cond.hxx"
 #include "Log.hxx"
 
 #ifdef ENABLE_ARCHIVE