logd: rename LogTimes -> LogReaderThread
LogTimes has evolved from being simply a store of the last timestamp
that each reader has read to being a class representing an individual
reader thread, including the thread function, so name it
appropriately.
Test: logging unit tests
Change-Id: I6914824376a6ff1f7509e657fa4dc044ead62954
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
index c6dea69..441f85b 100644
--- a/logd/LogReader.cpp
+++ b/logd/LogReader.cpp
@@ -42,7 +42,7 @@
void LogReader::notifyNewLog(log_mask_t log_mask) {
LastLogTimes& times = mLogbuf.mTimes;
- LogTimeEntry::wrlock();
+ LogReaderThread::wrlock();
for (const auto& entry : times) {
if (!entry->isWatchingMultiple(log_mask)) {
continue;
@@ -52,7 +52,7 @@
}
entry->triggerReader_Locked();
}
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
}
// Note returning false will release the SocketClient instance.
@@ -74,15 +74,15 @@
// Clients are only allowed to send one command, disconnect them if they
// send another.
- LogTimeEntry::wrlock();
+ LogReaderThread::wrlock();
for (const auto& entry : mLogbuf.mTimes) {
if (entry->mClient == cli) {
entry->release_Locked();
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
return false;
}
}
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
unsigned long tail = 0;
static const char _tail[] = " tail=";
@@ -137,8 +137,8 @@
if (!fastcmp<strncmp>(buffer, "dumpAndClose", 12)) {
// Allow writer to get some cycles, and wait for pending notifications
sched_yield();
- LogTimeEntry::wrlock();
- LogTimeEntry::unlock();
+ LogReaderThread::wrlock();
+ LogReaderThread::unlock();
sched_yield();
nonBlock = true;
}
@@ -217,11 +217,12 @@
timeout = 0;
}
- LogTimeEntry::wrlock();
- auto entry = std::make_unique<LogTimeEntry>(*this, cli, nonBlock, tail, logMask, pid, start,
- sequence, timeout, privileged, can_read_security);
+ LogReaderThread::wrlock();
+ auto entry =
+ std::make_unique<LogReaderThread>(*this, cli, nonBlock, tail, logMask, pid, start,
+ sequence, timeout, privileged, can_read_security);
if (!entry->startReader_Locked()) {
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
return false;
}
@@ -234,24 +235,24 @@
setsockopt(cli->getSocket(), SOL_SOCKET, SO_SNDTIMEO, (const char*)&t,
sizeof(t));
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
return true;
}
void LogReader::doSocketDelete(SocketClient* cli) {
LastLogTimes& times = mLogbuf.mTimes;
- LogTimeEntry::wrlock();
+ LogReaderThread::wrlock();
LastLogTimes::iterator it = times.begin();
while (it != times.end()) {
- LogTimeEntry* entry = it->get();
+ LogReaderThread* entry = it->get();
if (entry->mClient == cli) {
entry->release_Locked();
break;
}
it++;
}
- LogTimeEntry::unlock();
+ LogReaderThread::unlock();
}
int LogReader::getLogSocket() {