Standard library header <future> (C++11)
From cppreference.net
이 헤더는 스레드 지원 라이브러리의 일부입니다.
Classes |
||
|
(C++11)
|
비동기적 획득을 위한 값을 저장함
(클래스 템플릿) |
|
|
(C++11)
|
함수를 패키징하여 비동기적 검색을 위한 반환 값을 저장합니다
(클래스 템플릿) |
|
|
(C++11)
|
비동기적으로 설정되는 값을 기다림
(클래스 템플릿) |
|
|
(C++11)
|
비동기적으로 설정된 값(다른 future들이 참조할 수 있는)을 기다립니다
(클래스 템플릿) |
|
|
(C++11)
|
std::async
의 실행 정책을 지정합니다
(열거형) |
|
|
(C++11)
|
시간 제한 대기가 수행된 결과를 지정합니다
std::future
및
std::shared_future
(열거형) |
|
|
(C++11)
|
future나 promise와 관련된 오류를 보고함
(클래스) |
|
|
(C++11)
|
future 오류 코드를 식별합니다
(enum) |
|
|
std::uses_allocator
타입 특성의 특수화
(클래스 템플릿 특수화) |
||
|
(C++11)
(until C++17)
|
std::uses_allocator
타입 특성의 특수화
(클래스 템플릿 특수화) |
|
함수 |
||
|
(C++11)
|
함수를 비동기적으로(새 스레드에서 실행될 수 있음) 실행하고 결과를 담을
std::future
를 반환함
(함수 템플릿) |
|
|
(C++11)
|
future 에러 카테고리를 식별합니다
(함수) |
|
|
(C++11)
|
std::swap
알고리즘을 특수화함
(함수 템플릿) |
|
|
(C++11)
|
std::swap
알고리즘을 특수화합니다
(함수 템플릿) |
|
시놉시스
namespace std { enum class future_errc { broken_promise = /* 구현 정의 */, future_already_retrieved = /* 구현 정의 */, promise_already_satisfied = /* 구현 정의 */, no_state = /* 구현 정의 */ }; enum class launch : /* 지정되지 않음 */ { async = /* 지정되지 않음 */, deferred = /* 지정되지 않음 */, /* 구현 정의 */ }; enum class future_status { ready, timeout, deferred }; template<> struct is_error_code_enum<future_errc> : public true_type { }; error_code make_error_code(future_errc e) noexcept; error_condition make_error_condition(future_errc e) noexcept; const error_category& future_category() noexcept; class future_error; template<class R> class promise; template<class R> class promise<R&>; template<> class promise<void>; template<class R> void swap(promise<R>& x, promise<R>& y) noexcept; template<class R, class Alloc> struct uses_allocator<promise<R>, Alloc>; template<class R> class future; template<class R> class future<R&>; template<> class future<void>; template<class R> class shared_future; template<class R> class shared_future<R&>; template<> class shared_future<void>; template<class> class packaged_task; // 정의되지 않음 template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)>; template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>&, packaged_task<R(ArgTypes...)>&) noexcept; template<class F, class... Args> future<invoke_result_t<decay_t<F>, decay_t<Args>...>> async(F&& f, Args&&... args); template<class F, class... Args> future<invoke_result_t<decay_t<F>, decay_t<Args>...>> async(launch policy, F&& f, Args&&... args); }
클래스 std::future_error
namespace std { class future_error : public logic_error { public: explicit future_error(future_errc e); const error_code& code() const noexcept; const char* what() const noexcept; private: error_code ec_; // 설명용으로만 사용 }; }
클래스 템플릿 std::promise
namespace std { template<class R> class promise { public: promise(); template<class Allocator> promise(allocator_arg_t, const Allocator& a); promise(promise&& rhs) noexcept; promise(const promise&) = delete; ~promise(); // 할당 promise& operator=(promise&& rhs) noexcept; promise& operator=(const promise&) = delete; void swap(promise& other) noexcept; // 결과 획득 future<R> get_future(); // 결과 설정 void set_value(/* 설명 참조 */); void set_exception(exception_ptr p); // 지연된 알림과 함께 결과 설정 void set_value_at_thread_exit(/* 설명 참조 */); void set_exception_at_thread_exit(exception_ptr p); }; template<class R> void swap(promise<R>& x, promise<R>& y) noexcept; template<class R, class Alloc> struct uses_allocator<promise<R>, Alloc>; }
클래스 템플릿 std::future
namespace std { template<class R> class future { public: future() noexcept; future(future&&) noexcept; future(const future&) = delete; ~future(); future& operator=(const future&) = delete; future& operator=(future&&) noexcept; shared_future<R> share() noexcept; // 값 검색 /* 설명 참조 */ get(); // 상태 확인 함수 bool valid() const noexcept; void wait() const; template<class Rep, class Period> future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const; template<class Clock, class Duration> future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const; }; }
namespace std { template<class R> class shared_future { public: shared_future() noexcept; shared_future(const shared_future& rhs) noexcept; shared_future(future<R>&&) noexcept; shared_future(shared_future&& rhs) noexcept; ~shared_future(); shared_future& operator=(const shared_future& rhs) noexcept; shared_future& operator=(shared_future&& rhs) noexcept; // 값 반환 /* 설명 참조 */ get() const; // 상태 확인 함수 bool valid() const noexcept; void wait() const; template<class Rep, class Period> future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const; template<class Clock, class Duration> future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const; }; }
클래스 템플릿 std::packaged_task
namespace std { template<class> class packaged_task; // 정의되지 않음 template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)> { public: // 생성 및 소멸 packaged_task() noexcept; template<class F> explicit packaged_task(F&& f); ~packaged_task(); // 복사 불가 packaged_task(const packaged_task&) = delete; packaged_task& operator=(const packaged_task&) = delete; // 이동 지원 packaged_task(packaged_task&& rhs) noexcept; packaged_task& operator=(packaged_task&& rhs) noexcept; void swap(packaged_task& other) noexcept; bool valid() const noexcept; // 결과 획득 future<R> get_future(); // 실행 void operator()(ArgTypes... ); void make_ready_at_thread_exit(ArgTypes...); void reset(); }; template<class R, class... ArgTypes> packaged_task(R (*)(ArgTypes...)) -> packaged_task<R(ArgTypes...)>; template<class F> packaged_task(F) -> packaged_task</* 설명 참조 */>; template<class R, class... ArgTypes> void swap(packaged_task<R(ArgTypes...)>& x, packaged_task<R(ArgTypes...)>& y) noexcept; }