summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2014-04-04 14:47:44 -0500
committerMark Salyzyn2014-04-04 15:12:56 -0500
commit765f7828918b0eebe70ab9b16c31a2587969fc7e (patch)
treeb38b599aa082887f74307def405ad75e0d20177d /logd/LogTimes.cpp
parenta97798afc9105668a80b775516a7cc4db341a62e (diff)
downloadplatform-system-core-765f7828918b0eebe70ab9b16c31a2587969fc7e.tar.gz
platform-system-core-765f7828918b0eebe70ab9b16c31a2587969fc7e.tar.xz
platform-system-core-765f7828918b0eebe70ab9b16c31a2587969fc7e.zip
logd: transitory reader thread create should be detached
Bug: 13692914 Change-Id: Ia7306e6e844ae9f17c6f594bf6b25f3148652570
Diffstat (limited to 'logd/LogTimes.cpp')
-rw-r--r--logd/LogTimes.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index 8cb015ca3..c32ac2dce 100644
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -46,14 +46,25 @@ LogTimeEntry::LogTimeEntry(LogReader &reader, SocketClient *client,
46{ } 46{ }
47 47
48void LogTimeEntry::startReader_Locked(void) { 48void LogTimeEntry::startReader_Locked(void) {
49 pthread_attr_t attr;
50
49 threadRunning = true; 51 threadRunning = true;
50 if (pthread_create(&mThread, NULL, LogTimeEntry::threadStart, this)) { 52
51 threadRunning = false; 53 if (!pthread_attr_init(&attr)) {
52 if (mClient) { 54 if (!pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) {
53 mClient->decRef(); 55 if (!pthread_create(&mThread, &attr,
56 LogTimeEntry::threadStart, this)) {
57 pthread_attr_destroy(&attr);
58 return;
59 }
54 } 60 }
55 decRef_Locked(); 61 pthread_attr_destroy(&attr);
62 }
63 threadRunning = false;
64 if (mClient) {
65 mClient->decRef();
56 } 66 }
67 decRef_Locked();
57} 68}
58 69
59void LogTimeEntry::threadStop(void *obj) { 70void LogTimeEntry::threadStop(void *obj) {