thread/Mutex: use using instead of making it a derived class

Prepare the transition to std::mutex.
This commit is contained in:
Max Kellermann 2019-05-07 19:23:01 +02:00
parent 1b5c1f75a4
commit 0a0cc66e8f
19 changed files with 21 additions and 25 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2018 The Music Player Daemon Project * Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org * http://www.musicpd.org
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -21,8 +21,8 @@
#define MPD_ARCHIVE_FILE_HXX #define MPD_ARCHIVE_FILE_HXX
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "thread/Mutex.hxx"
class Mutex;
class ArchiveVisitor; class ArchiveVisitor;
class ArchiveFile { class ArchiveFile {

View File

@ -21,10 +21,10 @@
#define MPD_INPUT_PLUGIN_HXX #define MPD_INPUT_PLUGIN_HXX
#include "Ptr.hxx" #include "Ptr.hxx"
#include "thread/Mutex.hxx"
#include "util/Compiler.h" #include "util/Compiler.h"
struct ConfigBlock; struct ConfigBlock;
class Mutex;
class EventLoop; class EventLoop;
class RemoteTagScanner; class RemoteTagScanner;
class RemoteTagHandler; class RemoteTagHandler;

View File

@ -21,9 +21,9 @@
#define MPD_INPUT_LOCAL_OPEN_HXX #define MPD_INPUT_LOCAL_OPEN_HXX
#include "Ptr.hxx" #include "Ptr.hxx"
#include "thread/Mutex.hxx"
class Path; class Path;
class Mutex;
/** /**
* Open a "local" file. This is a wrapper for the input plugins * Open a "local" file. This is a wrapper for the input plugins

View File

@ -21,9 +21,9 @@
#define MPD_INPUT_ARCHIVE_HXX #define MPD_INPUT_ARCHIVE_HXX
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "thread/Mutex.hxx"
class Path; class Path;
class Mutex;
InputStreamPtr InputStreamPtr
OpenArchiveInputStream(Path path, Mutex &mutex); OpenArchiveInputStream(Path path, Mutex &mutex);

View File

@ -21,12 +21,11 @@
#define MPD_INPUT_CURL_HXX #define MPD_INPUT_CURL_HXX
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "thread/Mutex.hxx"
#include <string> #include <string>
#include <map> #include <map>
class Mutex;
extern const struct InputPlugin input_plugin_curl; extern const struct InputPlugin input_plugin_curl;
/** /**

View File

@ -21,9 +21,9 @@
#define MPD_INPUT_FILE_HXX #define MPD_INPUT_FILE_HXX
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "thread/Mutex.hxx"
class Path; class Path;
class Mutex;
InputStreamPtr InputStreamPtr
OpenFileInputStream(Path path, Mutex &mutex); OpenFileInputStream(Path path, Mutex &mutex);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2008-2017 Max Kellermann <max.kellermann@gmail.com> * Copyright 2008-2019 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@ -30,7 +30,8 @@
#ifndef CURL_INIT_HXX #ifndef CURL_INIT_HXX
#define CURL_INIT_HXX #define CURL_INIT_HXX
class Mutex; #include "thread/Mutex.hxx"
class EventLoop; class EventLoop;
class CurlGlobal; class CurlGlobal;

View File

@ -18,6 +18,5 @@
*/ */
#include "Mutex.hxx" #include "Mutex.hxx"
#include "thread/Mutex.hxx"
Mutex smbclient_mutex; Mutex smbclient_mutex;

View File

@ -20,7 +20,7 @@
#ifndef MPD_SMBCLIENT_MUTEX_HXX #ifndef MPD_SMBCLIENT_MUTEX_HXX
#define MPD_SMBCLIENT_MUTEX_HXX #define MPD_SMBCLIENT_MUTEX_HXX
class Mutex; #include "thread/Mutex.hxx"
/** /**
* Since libsmbclient is not thread-safe, this mutex must be locked * Since libsmbclient is not thread-safe, this mutex must be locked

View File

@ -45,7 +45,6 @@ struct FilteredAudioOutput;
struct MusicChunk; struct MusicChunk;
struct ConfigBlock; struct ConfigBlock;
class MusicPipe; class MusicPipe;
class Mutex;
class Mixer; class Mixer;
class AudioOutputClient; class AudioOutputClient;

View File

@ -26,6 +26,7 @@
#include "ReplayGainMode.hxx" #include "ReplayGainMode.hxx"
#include "pcm/PcmBuffer.hxx" #include "pcm/PcmBuffer.hxx"
#include "pcm/PcmDither.hxx" #include "pcm/PcmDither.hxx"
#include "thread/Mutex.hxx"
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
#include <utility> #include <utility>
@ -36,7 +37,6 @@
struct MusicChunk; struct MusicChunk;
struct Tag; struct Tag;
class Mutex;
class Filter; class Filter;
class PreparedFilter; class PreparedFilter;

View File

@ -20,11 +20,11 @@
#ifndef MPD_PLAYLIST_ANY_HXX #ifndef MPD_PLAYLIST_ANY_HXX
#define MPD_PLAYLIST_ANY_HXX #define MPD_PLAYLIST_ANY_HXX
#include "thread/Mutex.hxx"
#include "config.h" #include "config.h"
#include <memory> #include <memory>
class Mutex;
class SongEnumerator; class SongEnumerator;
class Storage; class Storage;

View File

@ -20,11 +20,11 @@
#ifndef MPD_PLAYLIST_MAPPER_HXX #ifndef MPD_PLAYLIST_MAPPER_HXX
#define MPD_PLAYLIST_MAPPER_HXX #define MPD_PLAYLIST_MAPPER_HXX
#include "thread/Mutex.hxx"
#include "config.h" #include "config.h"
#include <memory> #include <memory>
class Mutex;
class SongEnumerator; class SongEnumerator;
class Storage; class Storage;

View File

@ -21,10 +21,10 @@
#define MPD_PLAYLIST_PLUGIN_HXX #define MPD_PLAYLIST_PLUGIN_HXX
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "thread/Mutex.hxx"
struct ConfigBlock; struct ConfigBlock;
struct Tag; struct Tag;
class Mutex;
class SongEnumerator; class SongEnumerator;
struct playlist_plugin { struct playlist_plugin {

View File

@ -21,10 +21,10 @@
#define MPD_PLAYLIST_REGISTRY_HXX #define MPD_PLAYLIST_REGISTRY_HXX
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "thread/Mutex.hxx"
#include "util/Compiler.h" #include "util/Compiler.h"
struct ConfigData; struct ConfigData;
class Mutex;
class SongEnumerator; class SongEnumerator;
extern const struct playlist_plugin *const playlist_plugins[]; extern const struct playlist_plugin *const playlist_plugins[];

View File

@ -20,11 +20,11 @@
#ifndef MPD_PLAYLIST_STREAM_HXX #ifndef MPD_PLAYLIST_STREAM_HXX
#define MPD_PLAYLIST_STREAM_HXX #define MPD_PLAYLIST_STREAM_HXX
#include "thread/Mutex.hxx"
#include "util/Compiler.h" #include "util/Compiler.h"
#include <memory> #include <memory>
class Mutex;
class SongEnumerator; class SongEnumerator;
class Path; class Path;

View File

@ -25,12 +25,11 @@
#ifndef MPD_AIFF_HXX #ifndef MPD_AIFF_HXX
#define MPD_AIFF_HXX #define MPD_AIFF_HXX
#include <mutex> #include "thread/Mutex.hxx"
#include <stddef.h> #include <stddef.h>
class InputStream; class InputStream;
class Mutex;
/** /**
* Seeks the AIFF file to the ID3 chunk. * Seeks the AIFF file to the ID3 chunk.

View File

@ -25,11 +25,10 @@
#ifndef MPD_RIFF_HXX #ifndef MPD_RIFF_HXX
#define MPD_RIFF_HXX #define MPD_RIFF_HXX
#include <mutex> #include "thread/Mutex.hxx"
#include <stddef.h> #include <stddef.h>
class Mutex;
class InputStream; class InputStream;
/** /**

View File

@ -35,12 +35,12 @@
#ifdef _WIN32 #ifdef _WIN32
#include "CriticalSection.hxx" #include "CriticalSection.hxx"
class Mutex : public CriticalSection {}; using Mutex = CriticalSection;
#else #else
#include "PosixMutex.hxx" #include "PosixMutex.hxx"
class Mutex : public PosixMutex {}; using Mutex = PosixMutex;
#endif #endif