Imported Upstream version 2.50.2
[platform/upstream/glib.git] / glib / tests / thread.c
index 11d847b..5447836 100644 (file)
 #include <sys/resource.h>
 #endif
 
+#ifdef THREADS_POSIX
+#include <pthread.h>
+#endif
+
 static gpointer
 thread1_func (gpointer data)
 {
@@ -170,14 +174,12 @@ test_thread5 (void)
 static gpointer
 thread6_func (gpointer data)
 {
-#ifdef HAVE_SYS_PRCTL_H
-#ifdef PR_GET_NAME
-  const gchar name[16];
+#ifdef HAVE_PTHREAD_SETNAME_NP_WITH_TID
+  char name[16];
 
-  prctl (PR_GET_NAME, name, 0, 0, 0, 0);
+  pthread_getname_np (pthread_self(), name, 16);
 
-  g_assert_cmpstr (name, ==, (gchar*)data);
-#endif
+  g_assert_cmpstr (name, ==, data);
 #endif
 
   return NULL;