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
(cherry picked from commit f669acb018)
Bug: 17512203
Change-Id: I43cf0b4e2829b22b3ab4e537fa95ce13c76a869c
This commit is contained in:
parent
b3facbfdec
commit
7391575afd
1 changed files with 5 additions and 0 deletions
|
|
@ -92,6 +92,11 @@ bool LogReader::onDataAvailable(SocketClient *cli) {
|
||||||
|
|
||||||
bool nonBlock = false;
|
bool nonBlock = false;
|
||||||
if (strncmp(buffer, "dumpAndClose", 12) == 0) {
|
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;
|
nonBlock = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue