summaryrefslogtreecommitdiffstats
path: root/server/TcpSocketMonitor.cpp
diff options
context:
space:
mode:
authorBernie Innocenti <codewiz@google.com>2018-08-10 15:17:16 +0900
committerBernie Innocenti <codewiz@google.com>2018-08-10 16:21:24 +0900
commitabf8a346f81f6e16a543892ba9ece6a4750ede9f (patch)
treeae063a7869402755bc894c154204ba970253b914 /server/TcpSocketMonitor.cpp
parent9e81f67e0d29332fd8da26929bad22ecd712e61f (diff)
downloadplatform_system_netd-abf8a346f81f6e16a543892ba9ece6a4750ede9f.tar.gz
platform_system_netd-abf8a346f81f6e16a543892ba9ece6a4750ede9f.tar.bz2
platform_system_netd-abf8a346f81f6e16a543892ba9ece6a4750ede9f.zip
Let lock_guard deduce its template argument
No functional change, this is a cleanup. With C++17, it's no longer necessary to specify the teplate argument when it can be deduced from the types of constructor arguments. This allows de-cluttering our locking statements. To avoid typos, this patch was mechanically generated: perl -p -i -e 's/std::lock_guard<std::mutex>/std::lock_guard/g' \ $(find . -name '*.cpp' -o -name '*.h') Change-Id: Ibb15d9a6c5b1c861d81353e47d25474eb1d4c2df
Diffstat (limited to 'server/TcpSocketMonitor.cpp')
-rw-r--r--server/TcpSocketMonitor.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/TcpSocketMonitor.cpp b/server/TcpSocketMonitor.cpp
index 864c3bee5..3e620b15a 100644
--- a/server/TcpSocketMonitor.cpp
+++ b/server/TcpSocketMonitor.cpp
@@ -97,7 +97,7 @@ const String16 TcpSocketMonitor::DUMP_KEYWORD = String16("tcp_socket_info");
const milliseconds TcpSocketMonitor::kDefaultPollingInterval = milliseconds(30000);
void TcpSocketMonitor::dump(DumpWriter& dw) {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
dw.println("TcpSocketMonitor");
ScopedIndent tcpSocketMonitorDetails(dw);
@@ -150,7 +150,7 @@ void TcpSocketMonitor::dump(DumpWriter& dw) {
}
void TcpSocketMonitor::setPollingInterval(milliseconds nextSleepDurationMs) {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
mNextSleepDurationMs = nextSleepDurationMs;
@@ -160,7 +160,7 @@ void TcpSocketMonitor::setPollingInterval(milliseconds nextSleepDurationMs) {
void TcpSocketMonitor::resumePolling() {
bool wasSuspended;
{
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
wasSuspended = mIsSuspended;
mIsSuspended = false;
@@ -173,7 +173,7 @@ void TcpSocketMonitor::resumePolling() {
}
void TcpSocketMonitor::suspendPolling() {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
bool wasSuspended = mIsSuspended;
mIsSuspended = true;
@@ -185,7 +185,7 @@ void TcpSocketMonitor::suspendPolling() {
}
void TcpSocketMonitor::poll() {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
if (mIsSuspended) {
return;
@@ -252,7 +252,7 @@ void TcpSocketMonitor::waitForNextPoll() {
bool isSuspended;
milliseconds nextSleepDurationMs;
{
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
isSuspended = mIsSuspended;
nextSleepDurationMs= mNextSleepDurationMs;
}
@@ -266,7 +266,7 @@ void TcpSocketMonitor::waitForNextPoll() {
}
bool TcpSocketMonitor::isRunning() {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
return mIsRunning;
}
@@ -313,7 +313,7 @@ void TcpSocketMonitor::updateSocketStats(time_point now, Fwmark mark,
}
TcpSocketMonitor::TcpSocketMonitor() {
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
mNextSleepDurationMs = kDefaultPollingInterval;
mIsRunning = true;
@@ -329,7 +329,7 @@ TcpSocketMonitor::TcpSocketMonitor() {
TcpSocketMonitor::~TcpSocketMonitor() {
{
- std::lock_guard<std::mutex> guard(mLock);
+ std::lock_guard guard(mLock);
mIsRunning = false;
mIsSuspended = true;
}