am d1d2c15d: Merge "logd: transitory reader thread create should be detached"
* commit 'd1d2c15de8ea09989e8072d197c22020860f1461': logd: transitory reader thread create should be detached
This commit is contained in:
commit
113efaaeec
1 changed files with 16 additions and 5 deletions
|
|
@ -46,14 +46,25 @@ LogTimeEntry::LogTimeEntry(LogReader &reader, SocketClient *client,
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void LogTimeEntry::startReader_Locked(void) {
|
void LogTimeEntry::startReader_Locked(void) {
|
||||||
|
pthread_attr_t attr;
|
||||||
|
|
||||||
threadRunning = true;
|
threadRunning = true;
|
||||||
if (pthread_create(&mThread, NULL, LogTimeEntry::threadStart, this)) {
|
|
||||||
threadRunning = false;
|
if (!pthread_attr_init(&attr)) {
|
||||||
if (mClient) {
|
if (!pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) {
|
||||||
mClient->decRef();
|
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) {
|
void LogTimeEntry::threadStop(void *obj) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue