1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads, c++03
15 // void promise::set_value_at_thread_exit(R&& r);
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)));
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);