[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.threads / thread.thread.class / thread.thread.destr / dtor.pass.cpp
blob1d959e96dbcadd0018557f66b66bf26851427dab
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // UNSUPPORTED: no-threads
12 // <thread>
14 // class thread
16 // ~thread();
18 #include <cassert>
19 #include <cstdlib>
20 #include <exception>
21 #include <new>
22 #include <thread>
24 #include "make_test_thread.h"
25 #include "test_macros.h"
27 class G
29 int alive_;
30 public:
31 static int n_alive;
32 static bool op_run;
34 G() : alive_(1) {++n_alive;}
35 G(const G& g) : alive_(g.alive_) {++n_alive;}
36 ~G() {alive_ = 0; --n_alive;}
38 void operator()()
40 assert(alive_ == 1);
41 assert(n_alive >= 1);
42 op_run = true;
46 int G::n_alive = 0;
47 bool G::op_run = false;
49 void f1()
51 std::_Exit(0);
54 int main(int, char**)
56 std::set_terminate(f1);
58 assert(G::n_alive == 0);
59 assert(!G::op_run);
60 G g;
62 std::thread t = support::make_test_thread(g);
63 std::this_thread::sleep_for(std::chrono::milliseconds(250));
66 assert(false);
68 return 0;