Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6090df85 authored by Mathias Agopian's avatar Mathias Agopian Committed by Alex Ray
Browse files

rename binder services main thread to Binder_*

When a binder service's main thread joins the thread pool
it retains its name (whatever the exec name was), which is
very confusing in systrace.

we now rename that thread just like its friends in the
thread pool.

Change-Id: Ibb3b6ff07304b247cfc6fb1694e72350c579513e
parent 769828d2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ extern int androidCreateRawThreadEtc(android_thread_func_t entryFunction,
                                     size_t threadStackSize,
                                     android_thread_id_t *threadId);

// set the same of the running thread
extern void androidSetThreadName(const char* name);

// Used by the Java Runtime to control how threads are created, so that
// they can be proper and lovely Java threads.
typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction,
+22 −18
Original line number Diff line number Diff line
@@ -90,11 +90,19 @@ struct thread_data_t {
        }
        
        if (name) {
            androidSetThreadName(name);
            free(name);
        }
        return f(u);
    }
};

void androidSetThreadName(const char* name) {
#if defined(HAVE_PRCTL)
    // Mac OS doesn't have this, and we build libutil for the host too
    int hasAt = 0;
    int hasDot = 0;
            char *s = name;
    const char *s = name;
    while (*s) {
        if (*s == '.') hasDot = 1;
        else if (*s == '@') hasAt = 1;
@@ -108,11 +116,7 @@ struct thread_data_t {
    }
    prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0);
#endif
            free(name);
}
        return f(u);
    }
};

int androidCreateRawThreadEtc(android_thread_func_t entryFunction,
                               void *userData,