From 70cbe025f4afbc0236346da9ede0cd56cba38a12 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Wed, 16 Sep 2015 15:34:00 -0700 Subject: [PATCH] logd: update region lock after entry has passed to reader socket (cherry pick from commit de4bb9c1a704d0eab3320b43c3964342f4b662df) - The reader region level indicates the location to protect, but once it has been passed to the calling reader, then allow us to go one beyond so that a clear or prune thread can remove the entry. Bug: 23711431 Change-Id: I0f2389858dd8c83366c034360f67d7c363625b56 --- logd/LogTimes.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp index 68a068008..229be3cd5 100644 --- a/logd/LogTimes.cpp +++ b/logd/LogTimes.cpp @@ -128,9 +128,9 @@ void *LogTimeEntry::threadStart(void *obj) { lock(); - while (me->threadRunning && !me->isError_Locked()) { - uint64_t start = me->mStart; + uint64_t start = me->mStart; + while (me->threadRunning && !me->isError_Locked()) { unlock(); if (me->mTail) { @@ -143,8 +143,11 @@ void *LogTimeEntry::threadStart(void *obj) { if (start == LogBufferElement::FLUSH_ERROR) { me->error_Locked(); + break; } + me->mStart = start + 1; + if (me->mNonBlock || !me->threadRunning || me->isError_Locked()) { break; }