Use pthread_equal() to compare thread ID

Pthread document explicitly stated that == operator should not be used
to compare thread IDs. Let's use pthread_equal() to be safe.

BUG=chrome-os-partner:19235
TEST=Check trace dump can be generated from non-main thread
BRANCH=None

Change-Id: I5011e0e380db0ce43c4fcf8fca0d94d5b3108f55
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182039
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Vic (Chun-Ju) Yang
2014-01-10 12:02:22 +08:00
committed by chrome-internal-fetch
parent dc82ca44d3
commit 68d005b104

View File

@@ -178,7 +178,7 @@ static void __attribute__((noinline)) _task_dump_trace_dispatch(int sig)
{
int need_dispatch = 1;
if (pthread_self() != main_thread) {
if (!pthread_equal(pthread_self(), main_thread)) {
need_dispatch = 0;
} else if (!task_start_called()) {
fprintf(stderr, "Stack trace of main thread:\n");