1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This test verifies the correct handling of child thread exits.
16 pseudo_barrier_t g_barrier1;
17 pseudo_barrier_t g_barrier2;
22 // Synchronize with the main thread.
23 pseudo_barrier_wait(g_barrier1);
25 // Synchronize with the main thread and thread2.
26 pseudo_barrier_wait(g_barrier2);
36 // Synchronize with thread1 and the main thread.
37 pseudo_barrier_wait(g_barrier2); // Should not reach here.
46 pseudo_barrier_init(g_barrier1, 2);
47 pseudo_barrier_init(g_barrier2, 3);
50 std::thread thread_1(thread1);
52 // Wait for thread1 to start.
53 pseudo_barrier_wait(g_barrier1);
55 // Wait for thread1 to start.
56 std::thread thread_2(thread2);
58 // Thread 2 is waiting for another thread to reach the barrier.
59 // This should have for ever. (So we can run gcore against this process.)