Loading src/backend.cpp +8 −0 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,14 @@ void authdb::AuthBackend::unlock(){ } } void authdb::AuthBackend::lock_shared(){ void authdb::AuthBackend::lock_shared(){ // Refresh cluster data under exclusive lock (the cluster backend caches // internally for 30 s, so this is usually a no-op). { std::unique_lock<std::shared_timed_mutex> ex(_Lock, std::chrono::milliseconds(200)); if (ex.owns_lock()) { try { _Api->lock(); _Api->unlock(); } catch (...) {} } } if (!_Lock.try_lock_shared_for(std::chrono::seconds(5))) if (!_Lock.try_lock_shared_for(std::chrono::seconds(5))) throw AuthBackendError("backend shared lock timeout"); throw AuthBackendError("backend shared lock timeout"); } } Loading Loading
src/backend.cpp +8 −0 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,14 @@ void authdb::AuthBackend::unlock(){ } } void authdb::AuthBackend::lock_shared(){ void authdb::AuthBackend::lock_shared(){ // Refresh cluster data under exclusive lock (the cluster backend caches // internally for 30 s, so this is usually a no-op). { std::unique_lock<std::shared_timed_mutex> ex(_Lock, std::chrono::milliseconds(200)); if (ex.owns_lock()) { try { _Api->lock(); _Api->unlock(); } catch (...) {} } } if (!_Lock.try_lock_shared_for(std::chrono::seconds(5))) if (!_Lock.try_lock_shared_for(std::chrono::seconds(5))) throw AuthBackendError("backend shared lock timeout"); throw AuthBackendError("backend shared lock timeout"); } } Loading