logd: transitory reader thread create should be detached

Bug: 13692914
Change-Id: Ia7306e6e844ae9f17c6f594bf6b25f3148652570
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index 8cb015c..c32ac2d 100644
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -46,14 +46,25 @@
 { }
 
 void LogTimeEntry::startReader_Locked(void) {
+    pthread_attr_t attr;
+
     threadRunning = true;
-    if (pthread_create(&mThread, NULL, LogTimeEntry::threadStart, this)) {
-        threadRunning = false;
-        if (mClient) {
-            mClient->decRef();
+
+    if (!pthread_attr_init(&attr)) {
+        if (!pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) {
+            if (!pthread_create(&mThread, &attr,
+                                LogTimeEntry::threadStart, this)) {
+                pthread_attr_destroy(&attr);
+                return;
+            }
         }
-        decRef_Locked();
+        pthread_attr_destroy(&attr);
     }
+    threadRunning = false;
+    if (mClient) {
+        mClient->decRef();
+    }
+    decRef_Locked();
 }
 
 void LogTimeEntry::threadStop(void *obj) {