Clean up thread name support.

1. Define _GNU_SOURCE only if it's not defined, because the file may be
compiled with -D_GNU_SOURCE, which defines _GNU_SOURCE as 1, not empty.

2. Test worker->thread_name with NULL explicitly.

3. Shorten the thread name "aom frame worker" to "aom frameworker" so
it won't be truncated.

BUG=aomedia:2167

Change-Id: I7822c0ab80910769230206873f2bca6045d1396e
diff --git a/aom_util/aom_thread.c b/aom_util/aom_thread.c
index c5a1fab..b42c471 100644
--- a/aom_util/aom_thread.c
+++ b/aom_util/aom_thread.c
@@ -16,7 +16,9 @@
 
 // Enable GNU extensions in glibc so that we can call pthread_setname_np().
 // This must be before any #include statements.
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 
 #include <assert.h>
 #include <string.h>  // for memset()
@@ -39,7 +41,7 @@
 static THREADFN thread_loop(void *ptr) {
   AVxWorker *const worker = (AVxWorker *)ptr;
 #if defined(__GLIBC__) || defined(__BIONIC__)
-  if (worker->thread_name) {
+  if (worker->thread_name != NULL) {
     // Android and recent versions of glibc on Linux have a form of
     // pthread_setname_np().
     // Linux requires names (with nul) fit in 16 chars, otherwise
diff --git a/av1/av1_dx_iface.c b/av1/av1_dx_iface.c
index 69e0e86..6e8c7f2 100644
--- a/av1/av1_dx_iface.c
+++ b/av1/av1_dx_iface.c
@@ -402,7 +402,7 @@
     AVxWorker *const worker = &ctx->frame_workers[i];
     FrameWorkerData *frame_worker_data = NULL;
     winterface->init(worker);
-    worker->thread_name = "aom frame worker";
+    worker->thread_name = "aom frameworker";
     worker->data1 = aom_memalign(32, sizeof(FrameWorkerData));
     if (worker->data1 == NULL) {
       set_error_detail(ctx, "Failed to allocate frame_worker_data");