From a32a6e1abe6972b48b4d5ec79d81b6f7241723bf Mon Sep 17 00:00:00 2001
From: Daniel Dunbar <daniel@zuster.org>
Date: Thu, 4 Nov 2010 01:26:31 +0000
Subject: [PATCH] c-index-test: Switch to using clang_executeOnThread instead
 of mucking about with system specific stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118224 91177308-0d34-0410-b5e6-96231b3b80d8
---
 tools/c-index-test/c-index-test.c | 28 +---------------------------
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/tools/c-index-test/c-index-test.c b/tools/c-index-test/c-index-test.c
index eae69469823..d0e4cb9e3ea 100644
--- a/tools/c-index-test/c-index-test.c
+++ b/tools/c-index-test/c-index-test.c
@@ -1578,11 +1578,6 @@ int cindextest_main(int argc, const char **argv) {
  * testing of a multithreaded environment (for example, having a reduced stack
  * size). */
 
-#include "llvm/Config/config.h"
-#ifdef HAVE_PTHREAD_H
-
-#include <pthread.h>
-
 typedef struct thread_info {
   int argc;
   const char **argv;
@@ -1596,33 +1591,12 @@ void *thread_runner(void *client_data_v) {
 
 int main(int argc, const char **argv) {
   thread_info client_data;
-  pthread_t thread;
-  int res;
 
   if (getenv("CINDEXTEST_NOTHREADS"))
     return cindextest_main(argc, argv);
 
   client_data.argc = argc;
   client_data.argv = argv;
-  res = pthread_create(&thread, 0, thread_runner, &client_data);
-  if (res != 0) {
-    perror("thread creation failed");
-    return 1;
-  }
-
-  res = pthread_join(thread, 0);
-  if (res != 0) {
-    perror("thread join failed");
-    return 1;
-  }
-
+  clang_executeOnThread(thread_runner, &client_data, 0);
   return client_data.result;
 }
-
-#else
-
-int main(int argc, const char **argv) {
-  return cindextest_main(argc, argv);
-}
-
-#endif
-- 
GitLab