Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / thread / futures / futures.promise / set_lvalue_at_thread_exit.pass.cpp
blob314293cbdf28be3356ee8f929016c9a9271f41e7
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
10 // UNSUPPORTED: c++03
12 // <future>
14 // class promise<R>
16 // void promise<R&>::set_value_at_thread_exit(R& r);
18 #include <future>
19 #include <memory>
20 #include <cassert>
22 #include "make_test_thread.h"
23 #include "test_macros.h"
25 int i = 0;
27 void func(std::promise<int&> p)
29 p.set_value_at_thread_exit(i);
30 i = 4;
33 int main(int, char**)
36 std::promise<int&> p;
37 std::future<int&> f = p.get_future();
38 support::make_test_thread(func, std::move(p)).detach();
39 assert(f.get() == 4);
42 return 0;