summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-09-16 09:19:47 -0700
committerMark Salyzyn <salyzyn@google.com>2014-09-29 17:40:10 +0000
commitf669acb01880216b6c1d29fc226f2c3ec3a6368a (patch)
treeddb806912d2abdb7b526cae9fb7cedf1fec93623
parent68c19686e8f9b5a88e3b2729a453d03516be79f1 (diff)
downloadsystem_core-f669acb01880216b6c1d29fc226f2c3ec3a6368a.zip
system_core-f669acb01880216b6c1d29fc226f2c3ec3a6368a.tar.gz
system_core-f669acb01880216b6c1d29fc226f2c3ec3a6368a.tar.bz2
logd: in nonblocking read, sched_yield() synchronization
- sched_yield and lock synchronization in reader thread startup to give writer thread a chance to catch up Bug: 17512203 Change-Id: I43cf0b4e2829b22b3ab4e537fa95ce13c76a869c
-rw-r--r--logd/LogReader.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
index 8458c19..26df087 100644
--- a/logd/LogReader.cpp
+++ b/logd/LogReader.cpp
@@ -92,6 +92,11 @@ bool LogReader::onDataAvailable(SocketClient *cli) {
bool nonBlock = false;
if (strncmp(buffer, "dumpAndClose", 12) == 0) {
+ // Allow writer to get some cycles, and wait for pending notifications
+ sched_yield();
+ LogTimeEntry::lock();
+ LogTimeEntry::unlock();
+ sched_yield();
nonBlock = true;
}