Vous êtes sur la page 1sur 1

C++ Concurrency thread () M M= packaged_task<RetType, condition_variable ()

thread<F, Args...>(F&&, Args&&...) ArgTypes...> () M M= void notify_one()


future<RetType> () M M= construct from F and Args unblock one of the waiting threads
packaged_task<F>(F&&)
RetType | RetType& | void get() bool joinable() void notify_all()
true if the thread hasn't been detached packaged_task<F, Alloc>(allocator_arg_t, const unblock all of the waiting threads
get the result - blocks until result is ready; return
type determined by RetType template parameter Alloc&, F&&)
void join() construct from F, using Alloc for internal data structures void wait(unique_lock<mutex>&, [Predicate])
bool valid() block until thread completes (if provided) unlock the mutex and block the thread until the
true if get hasn't been called condition variable is signalled; use Predicate to
void detach() future<RetType> get_future() check for spurious wakeups
shared_future<RetType> share() give up control of the thread return a future for this task
convert future to shared_future cv_status | bool wait_until
id get_id() void operator()(ArgTypes...) (unique_lock<mutex>&, const time_point&,
void wait() get thread ID execute the task and signal the future
block until result is available
[Predicate])
native_handle_type native_handle() bool valid() like wait, but only wait until specified time point;
future_status wait_for(const duration&) get platform specific thread handle true if the task has shared state return cv_status or, if Predicate is supplied, the value
wait for the result for a specified period; unblock of Predicate
when result is available or after duration elapsed
static unsigned hardware_concurrency() void make_ready_at_thread_exit(ArgTypes...)
return an estimate of hardware thread contexts execute the task and signal the future at thread exit cv_status | bool wait_for
future_status wait_until(const time_point&) (unique_lock<mutex>&, const duration&,
void reset()
wait for the result until the specfied point in time;
unblock when result is available or when time
this_thread namespace construct new shared state, abandon old state
[Predicate])
like wait, but only wait for the specified duration;
point passed thread::id get_id() return cv_status or, if Predicate is supplied, the value
return the unique ID of the calling thread promise<RetType> () M M= of Predicate
shared_future<RetType> void yield() native_handle_type native_handle()
offer the implementation a chance to reschedule promise<Alloc>(allocator_arg_t, const Alloc&)
get platform specific handle
() C C= M M= construct using Alloc for shared state
void sleep_until(const time_point&)
block the calling thread until specified time future<RetType> get_future() condition_variable_any ()
shared_future(future<RetType>&&) return a future for this promise
move-construct from a future void sleep_for(const duration&)
block the calling thread for specified period void set_value(const RetType&) Same interface as condition_variable, but wait*
void set_value(RetType&& | RetType& | void) methods allow a custom lock class in place of
RetType | RetType& | void get()
unique_lock, and native_handle method isn't
get the result - blocks until result is ready; return set the result and signal the future
type determined by RetType template parameter Free functions available
void set_exception(exception_ptr)
bool valid() future<RetTypeOfF> async([launch], F&&, set an exception and signal the future
mutex/recursive_mutex ()
true if get hasn't been called Args&&...) void set_value_at_thread_exit(const RetType&)
shared_future<RetType> share()
return a future and execute F with Args according void lock()
to launch policy if provided, or with launch::async | void set_value_at_thread_exit(RetType&& | recursive_mutex allows multiple calls to lock with
convert future to shared_future launch::deferred otherwise RetType& | void) increasing levels of ownership
void wait() set result and signal the future at thread exit
void lock<L1, L2, L3...>(L1&, L2&, L3&...) bool try_lock()
block until result is available lock all arguments using a deadlock avoidance void set_exception_at_thread_exit immediately return false if unable to lock
future_status wait_for(const duration&) algorithm; in case of failure, unlock all previously (exception_ptr)
locked arguments and return set exception and signal the future at thread exit
void unlock()
wait for the result for a specified period; unblock
when result is available or after duration int try_lock<L1, L2, L3...>(L1&, L2&, L3&...) native_handle_type native_handle()
future_status wait_until(const time_point&) call try_lock on each argument in order & return -1; unique_lock<Mutex> () M M= get platform specific handle
wait for the result until the specfied point in time if an argument can't be locked, unlock all previous
arguments & return its index unique_lock(Mutex&, [defer_lock_t | timed_mutex/
Legend void call_once(once_flag&, F&&, Args&&...) try_to_lock_t | adopt_lock_t])
possibly acquire mutex on construction
recursive_timed_mutex ()
default copy assignment execute F with Args only once in a multi-threaded
() C= context
constructor operator mutex_type* release() Same as mutex/recursive_mutex, with two extra
unlock and return a pointer to mutex methods:
copy move assignment
C
constructor
M=
operator lock_guard<Mutex> bool owns_lock() bool try_lock_for(const duration&)
true if the mutex is locked try to lock for the specified duration
M
move
swap method lock_guard(Mutex&, [adopt_lock_t])
constructor lock the mutex on construction and release on mutex_type* mutex() bool try_lock_until(const time_point&)
destruction return a pointer to mutex try to lock until the specified time point
cpprocks.com
Also has the same methods as timed_mutex (except
@cpp_rocks native_handle)

Vous aimerez peut-être aussi