Merge remote-tracking branches 'neheb/1', 'neheb/2', 'neheb/3', 'neheb/4' and 'neheb/5'
This commit is contained in:
@@ -61,7 +61,7 @@ public:
|
||||
CurlSocket(const CurlSocket &) = delete;
|
||||
CurlSocket &operator=(const CurlSocket &) = delete;
|
||||
|
||||
auto &GetEventLoop() const noexcept {
|
||||
[[nodiscard]] auto &GetEventLoop() const noexcept {
|
||||
return socket_event.GetEventLoop();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
void *userp, void *socketp) noexcept;
|
||||
|
||||
private:
|
||||
SocketDescriptor GetSocket() const noexcept {
|
||||
[[nodiscard]] SocketDescriptor GetSocket() const noexcept {
|
||||
return socket_event.GetSocket();
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ CurlGlobal *CurlInit::instance;
|
||||
|
||||
CurlInit::CurlInit(EventLoop &event_loop)
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
if (++ref > 1) {
|
||||
assert(&event_loop == &instance->GetEventLoop());
|
||||
return;
|
||||
@@ -56,7 +56,7 @@ CurlInit::CurlInit(EventLoop &event_loop)
|
||||
|
||||
CurlInit::~CurlInit() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
if (--ref > 0)
|
||||
return;
|
||||
|
||||
|
@@ -105,7 +105,7 @@ AllocatedString
|
||||
IcuConverter::ToUTF8(std::string_view s) const
|
||||
{
|
||||
#ifdef HAVE_ICU
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
ucnv_resetToUnicode(converter);
|
||||
|
||||
@@ -133,7 +133,7 @@ AllocatedString
|
||||
IcuConverter::FromUTF8(std::string_view s) const
|
||||
{
|
||||
#ifdef HAVE_ICU
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
const auto u = UCharFromUTF8(s);
|
||||
|
||||
|
@@ -68,7 +68,7 @@ private:
|
||||
* thread.
|
||||
*/
|
||||
void LockSetFinished() noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
finished = true;
|
||||
cond.notify_one();
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ SmbclientContext::New()
|
||||
SMBCCTX *ctx;
|
||||
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(global_mutex);
|
||||
const std::scoped_lock<Mutex> protect(global_mutex);
|
||||
ctx = smbc_new_context();
|
||||
}
|
||||
|
||||
|
@@ -48,7 +48,7 @@ public:
|
||||
|
||||
~SmbclientContext() noexcept {
|
||||
if (ctx != nullptr) {
|
||||
const std::lock_guard<Mutex> protect(global_mutex);
|
||||
const std::scoped_lock<Mutex> protect(global_mutex);
|
||||
smbc_free_context(ctx, 1);
|
||||
}
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ UpnpClientGlobalInit(const char* iface)
|
||||
UpnpGlobalInit(iface);
|
||||
|
||||
try {
|
||||
const std::lock_guard<Mutex> protect(upnp_client_init_mutex);
|
||||
const std::scoped_lock<Mutex> protect(upnp_client_init_mutex);
|
||||
if (upnp_client_ref == 0)
|
||||
DoInit();
|
||||
} catch (...) {
|
||||
@@ -78,7 +78,7 @@ void
|
||||
UpnpClientGlobalFinish() noexcept
|
||||
{
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(upnp_client_init_mutex);
|
||||
const std::scoped_lock<Mutex> protect(upnp_client_init_mutex);
|
||||
|
||||
assert(upnp_client_ref > 0);
|
||||
if (--upnp_client_ref == 0)
|
||||
|
@@ -41,14 +41,14 @@ UPnPDeviceDirectory::Downloader::Downloader(UPnPDeviceDirectory &_parent,
|
||||
expires(std::chrono::seconds(UpnpDiscovery_get_Expires(&disco))),
|
||||
request(*parent.curl, url.c_str(), *this)
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(parent.mutex);
|
||||
const std::scoped_lock<Mutex> protect(parent.mutex);
|
||||
parent.downloaders.push_back(*this);
|
||||
}
|
||||
|
||||
void
|
||||
UPnPDeviceDirectory::Downloader::Destroy() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(parent.mutex);
|
||||
const std::scoped_lock<Mutex> protect(parent.mutex);
|
||||
unlink();
|
||||
delete this;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ AnnounceLostUPnP(UPnPDiscoveryListener &listener, const UPnPDevice &device)
|
||||
inline void
|
||||
UPnPDeviceDirectory::LockAdd(ContentDirectoryDescriptor &&d)
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
for (auto &i : directories) {
|
||||
if (i.id == d.id) {
|
||||
@@ -157,7 +157,7 @@ UPnPDeviceDirectory::LockAdd(ContentDirectoryDescriptor &&d)
|
||||
inline void
|
||||
UPnPDeviceDirectory::LockRemove(const std::string &id)
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
for (auto i = directories.begin(), end = directories.end();
|
||||
i != end; ++i) {
|
||||
@@ -265,10 +265,10 @@ UPnPDeviceDirectory::UPnPDeviceDirectory(EventLoop &event_loop,
|
||||
|
||||
UPnPDeviceDirectory::~UPnPDeviceDirectory() noexcept
|
||||
{
|
||||
BlockingCall(GetEventLoop(), [this](){
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
downloaders.clear_and_dispose(DeleteDisposer());
|
||||
});
|
||||
BlockingCall(GetEventLoop(), [this]() {
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
downloaders.clear_and_dispose(DeleteDisposer());
|
||||
});
|
||||
}
|
||||
|
||||
inline EventLoop &
|
||||
@@ -308,7 +308,7 @@ UPnPDeviceDirectory::Search()
|
||||
std::vector<ContentDirectoryService>
|
||||
UPnPDeviceDirectory::GetDirectories()
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
ExpireDevices();
|
||||
|
||||
@@ -327,7 +327,7 @@ UPnPDeviceDirectory::GetDirectories()
|
||||
ContentDirectoryService
|
||||
UPnPDeviceDirectory::GetServer(std::string_view friendly_name)
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
ExpireDevices();
|
||||
|
||||
|
@@ -56,7 +56,7 @@ DoInit(const char* iface)
|
||||
void
|
||||
UpnpGlobalInit(const char* iface)
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(upnp_init_mutex);
|
||||
const std::scoped_lock<Mutex> protect(upnp_init_mutex);
|
||||
|
||||
if (upnp_ref == 0)
|
||||
DoInit(iface);
|
||||
@@ -67,7 +67,7 @@ UpnpGlobalInit(const char* iface)
|
||||
void
|
||||
UpnpGlobalFinish() noexcept
|
||||
{
|
||||
const std::lock_guard<Mutex> protect(upnp_init_mutex);
|
||||
const std::scoped_lock<Mutex> protect(upnp_init_mutex);
|
||||
|
||||
assert(upnp_ref > 0);
|
||||
|
||||
|
Reference in New Issue
Block a user