logd: start cleaning up LogReaderThread
1) We can use real member functions with std::thread and
std::function, so use those instead of the 'me' pointer.
2) Don't expose member variables directly.
3) Rename and document member variables, since all of their references
are being touched anyway.
Test: logging unit tests
Change-Id: I9a357a3ea8691433d58687c95356b984b83e9c36
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
index 8816269..4702de5 100644
--- a/logd/LogReader.cpp
+++ b/logd/LogReader.cpp
@@ -39,15 +39,15 @@
// When we are notified a new log entry is available, inform
// listening sockets who are watching this entry's log id.
-void LogReader::notifyNewLog(log_mask_t log_mask) {
+void LogReader::notifyNewLog(unsigned int log_mask) {
LastLogTimes& times = mLogbuf.mTimes;
LogReaderThread::wrlock();
for (const auto& entry : times) {
- if (!entry->isWatchingMultiple(log_mask)) {
+ if (!entry->IsWatchingMultiple(log_mask)) {
continue;
}
- if (entry->mTimeout.tv_sec || entry->mTimeout.tv_nsec) {
+ if (entry->timeout().tv_sec || entry->timeout().tv_nsec) {
continue;
}
entry->triggerReader_Locked();
@@ -76,7 +76,7 @@
// send another.
LogReaderThread::wrlock();
for (const auto& entry : mLogbuf.mTimes) {
- if (entry->mClient == cli) {
+ if (entry->client() == cli) {
entry->release_Locked();
LogReaderThread::unlock();
return false;
@@ -227,7 +227,7 @@
LastLogTimes::iterator it = times.begin();
while (it != times.end()) {
LogReaderThread* entry = it->get();
- if (entry->mClient == cli) {
+ if (entry->client() == cli) {
entry->release_Locked();
break;
}