*: use std::scoped_lock with implicit template parameter
This commit is contained in:
@@ -222,7 +222,7 @@ AlsaInputStream::DispatchSockets() noexcept
|
||||
try {
|
||||
non_block.DispatchSockets(*this, capture_handle);
|
||||
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
auto w = PrepareWriteBuffer();
|
||||
const snd_pcm_uframes_t w_frames = w.size() / frame_size;
|
||||
|
||||
@@ -266,7 +266,7 @@ CurlInputStream::OnHeaders(unsigned status,
|
||||
FmtBuffer<40>("got HTTP status {}",
|
||||
status).c_str());
|
||||
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
if (IsSeekPending()) {
|
||||
/* don't update metadata while seeking */
|
||||
@@ -329,7 +329,7 @@ CurlInputStream::OnData(std::span<const std::byte> data)
|
||||
{
|
||||
assert(!data.empty());
|
||||
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
if (IsSeekPending())
|
||||
SeekDone();
|
||||
@@ -345,7 +345,7 @@ CurlInputStream::OnData(std::span<const std::byte> data)
|
||||
void
|
||||
CurlInputStream::OnEnd()
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
InvokeOnAvailable();
|
||||
|
||||
AsyncInputStream::SetClosed();
|
||||
@@ -354,7 +354,7 @@ CurlInputStream::OnEnd()
|
||||
void
|
||||
CurlInputStream::OnError(std::exception_ptr e) noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
postponed_exception = std::move(e);
|
||||
|
||||
if (IsSeekPending())
|
||||
|
||||
@@ -138,7 +138,7 @@ NfsInputStream::DoSeek(offset_type new_offset)
|
||||
void
|
||||
NfsInputStream::OnNfsFileOpen(uint64_t _size) noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
if (reconnecting) {
|
||||
/* reconnect has succeeded */
|
||||
@@ -158,7 +158,7 @@ NfsInputStream::OnNfsFileOpen(uint64_t _size) noexcept
|
||||
void
|
||||
NfsInputStream::OnNfsFileRead(std::span<const std::byte> src) noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
assert(!IsBufferFull());
|
||||
assert(IsBufferFull() == (GetBufferSpace() == 0));
|
||||
|
||||
@@ -172,7 +172,7 @@ NfsInputStream::OnNfsFileRead(std::span<const std::byte> src) noexcept
|
||||
void
|
||||
NfsInputStream::OnNfsFileError(std::exception_ptr &&e) noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
if (IsPaused()) {
|
||||
/* while we're paused, don't report this error to the
|
||||
|
||||
@@ -71,7 +71,7 @@ QobuzClient::StartLogin()
|
||||
void
|
||||
QobuzClient::AddLoginHandler(QobuzSessionHandler &h) noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
assert(!h.is_linked());
|
||||
|
||||
const bool was_empty = handlers.empty();
|
||||
@@ -98,7 +98,7 @@ QobuzClient::AddLoginHandler(QobuzSessionHandler &h) noexcept
|
||||
QobuzSession
|
||||
QobuzClient::GetSession() const
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
if (error)
|
||||
std::rethrow_exception(error);
|
||||
@@ -113,7 +113,7 @@ void
|
||||
QobuzClient::OnQobuzLoginSuccess(QobuzSession &&_session) noexcept
|
||||
{
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
session = std::move(_session);
|
||||
login_request.reset();
|
||||
}
|
||||
@@ -125,7 +125,7 @@ void
|
||||
QobuzClient::OnQobuzLoginError(std::exception_ptr _error) noexcept
|
||||
{
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
error = std::move(_error);
|
||||
login_request.reset();
|
||||
}
|
||||
@@ -136,7 +136,7 @@ QobuzClient::OnQobuzLoginError(std::exception_ptr _error) noexcept
|
||||
void
|
||||
QobuzClient::InvokeHandlers() noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
while (!handlers.empty()) {
|
||||
auto &h = handlers.front();
|
||||
handlers.pop_front();
|
||||
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
void AddLoginHandler(QobuzSessionHandler &h) noexcept;
|
||||
|
||||
void RemoveLoginHandler(QobuzSessionHandler &h) noexcept {
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
if (h.is_linked())
|
||||
h.unlink();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
void
|
||||
QobuzInputStream::OnQobuzSession() noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
try {
|
||||
const auto session = qobuz_client->GetSession();
|
||||
@@ -87,7 +87,7 @@ QobuzInputStream::OnQobuzSession() noexcept
|
||||
void
|
||||
QobuzInputStream::OnQobuzTrackSuccess(std::string url) noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
track_request.reset();
|
||||
|
||||
try {
|
||||
@@ -101,7 +101,7 @@ QobuzInputStream::OnQobuzTrackSuccess(std::string url) noexcept
|
||||
void
|
||||
QobuzInputStream::OnQobuzTrackError(std::exception_ptr e) noexcept
|
||||
{
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
track_request.reset();
|
||||
|
||||
Failed(e);
|
||||
|
||||
@@ -133,7 +133,7 @@ UringInputStream::OnRead(std::unique_ptr<std::byte[]> data,
|
||||
{
|
||||
read_operation.reset();
|
||||
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
if (nbytes == 0) {
|
||||
postponed_exception = std::make_exception_ptr(std::runtime_error("Premature end of file"));
|
||||
@@ -154,7 +154,7 @@ UringInputStream::OnReadError(int error) noexcept
|
||||
{
|
||||
read_operation.reset();
|
||||
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
const std::scoped_lock protect{mutex};
|
||||
|
||||
postponed_exception = std::make_exception_ptr(MakeErrno(error, "Read failed"));
|
||||
InvokeOnAvailable();
|
||||
|
||||
Reference in New Issue
Block a user