Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / thread / futures / futures.promise / set_rvalue_at_thread_exit.pass.cpp
blobb51f549f26d333e11de810276c5dcfb71b4291b7
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, c++03
11 // <future>
13 // class promise<R>
15 // void promise::set_value_at_thread_exit(R&& r);
17 #include <future>
18 #include <memory>
19 #include <cassert>
21 #include "make_test_thread.h"
22 #include "test_macros.h"
24 void func(std::promise<std::unique_ptr<int>> p)
26 p.set_value_at_thread_exit(std::unique_ptr<int>(new int(5)));
29 int main(int, char**)
32 std::promise<std::unique_ptr<int>> p;
33 std::future<std::unique_ptr<int>> f = p.get_future();
34 support::make_test_thread(func, std::move(p)).detach();
35 assert(*f.get() == 5);
38 return 0;