diff options
Diffstat (limited to 'simpleperf/runtest/function_pthread.cpp')
-rw-r--r-- | simpleperf/runtest/function_pthread.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/simpleperf/runtest/function_pthread.cpp b/simpleperf/runtest/function_pthread.cpp index 02fc0a5f..c80fb3f2 100644 --- a/simpleperf/runtest/function_pthread.cpp +++ b/simpleperf/runtest/function_pthread.cpp @@ -17,17 +17,19 @@ void MainThreadFunction() { } int main() { - pthread_t thread; - int ret = pthread_create(&thread, nullptr, ChildThreadFunction, nullptr); - if (ret != 0) { - fprintf(stderr, "pthread_create failed: %s\n", strerror(ret)); - exit(1); - } - MainThreadFunction(); - ret = pthread_join(thread, nullptr); - if (ret != 0) { - fprintf(stderr, "pthread_join failed: %s\n", strerror(ret)); - exit(1); + while (true) { + pthread_t thread; + int ret = pthread_create(&thread, nullptr, ChildThreadFunction, nullptr); + if (ret != 0) { + fprintf(stderr, "pthread_create failed: %s\n", strerror(ret)); + exit(1); + } + MainThreadFunction(); + ret = pthread_join(thread, nullptr); + if (ret != 0) { + fprintf(stderr, "pthread_join failed: %s\n", strerror(ret)); + exit(1); + } } return 0; } |