STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
thread Class Reference

Classes

class  id
 

Public Types

typedef voidnative_handle_type
 

Public Member Functions

 thread () _NOEXCEPT
 
template<class _Fn , class... _Args, class = typename enable_if< !is_same<typename decay<_Fn>::type, thread>::value>::type>
 thread (_Fn &&_Fx, _Args &&..._Ax)
 
 ~thread () _NOEXCEPT
 
 thread (thread &&_Other) _NOEXCEPT
 
threadoperator= (thread &&_Other) _NOEXCEPT
 
 thread (const thread &)=delete
 
threadoperator= (const thread &)=delete
 
void swap (thread &_Other) _NOEXCEPT
 
bool joinable () const _NOEXCEPT
 
void join ()
 
void detach ()
 
id get_id () const _NOEXCEPT
 
native_handle_type native_handle ()
 

Static Public Member Functions

static unsigned int hardware_concurrency () _NOEXCEPT
 

Private Member Functions

thread_Move_thread (thread &_Other)
 

Private Attributes

_Thrd_t _Thr
 

Member Typedef Documentation

Constructor & Destructor Documentation

thread::thread ( )
inline
36  { // construct with no thread
38  }
_Thrd_t _Thr
Definition: thread:115
#define _Thr_set_null(thr)
Definition: xthrcommon.h:39
template<class _Fn , class... _Args, class = typename enable_if< !is_same<typename decay<_Fn>::type, thread>::value>::type>
thread::thread ( _Fn &&  _Fx,
_Args &&...  _Ax 
)
inlineexplicit
46  { // construct with _Fx(_Ax...)
47  _Launch(&_Thr,
49  _STD forward<_Fn>(_Fx), _STD forward<_Args>(_Ax)...));
50  }
enable_if<!is_array< _Ty >::value, unique_ptr< _Ty > >::type make_unique(_Types &&..._Args)
Definition: memory:2052
void _Launch(_Thrd_t *_Thr, _Target &&_Tg)
Definition: xthread:257
typename decay< _Ty >::type decay_t
Definition: type_traits:2095
Definition: tuple:220
_Thrd_t _Thr
Definition: thread:115
thread::~thread ( )
inline
54  { // clean up
55  if (joinable())
56  _STD terminate();
57  }
void __CRTDECL terminate() _NOEXCEPT
Definition: exception:208
bool joinable() const _NOEXCEPT
Definition: thread:78
thread::thread ( thread &&  _Other)
inline
60  : _Thr(_Other._Thr)
61  { // move from _Other
62  _Thr_set_null(_Other._Thr);
63  }
_Thrd_t _Thr
Definition: thread:115
#define _Thr_set_null(thr)
Definition: xthrcommon.h:39
thread::thread ( const thread )
delete

Member Function Documentation

thread& thread::_Move_thread ( thread _Other)
inlineprivate
107  { // move from _Other
108  if (joinable())
109  _STD terminate();
110  _Thr = _Other._Thr;
111  _Thr_set_null(_Other._Thr);
112  return (*this);
113  }
void __CRTDECL terminate() _NOEXCEPT
Definition: exception:208
bool joinable() const _NOEXCEPT
Definition: thread:78
_Thrd_t _Thr
Definition: thread:115
#define _Thr_set_null(thr)
Definition: xthrcommon.h:39
void thread::detach ( )
inline
86  { // detach thread
87  if (!joinable())
91  }
Definition: xthread:22
bool joinable() const _NOEXCEPT
Definition: thread:78
int _Thrd_detachX(_Thrd_t _Thr)
Definition: xthread:54
_CRTIMP2_PURE void __cdecl _Throw_Cpp_error(int _Code)
_Thrd_t _Thr
Definition: thread:115
#define _Thr_set_null(thr)
Definition: xthrcommon.h:39
thread::id thread::get_id ( ) const
inline
199  { // return id for this thread
200  return (_Thr_val(_Thr));
201  }
#define _Thr_val(thr)
Definition: xthrcommon.h:38
_Thrd_t _Thr
Definition: thread:115
static unsigned int thread::hardware_concurrency ( )
inlinestatic
96  { // return number of hardware thread contexts
97  return (_Thrd_hardware_concurrency());
98  }
_CRTIMP2_PURE unsigned int __cdecl _Thrd_hardware_concurrency(void)
void thread::join ( )
inline
185  { // join thread
186  if (!joinable())
188  const bool _Is_null = _Thr_is_null(_Thr); // Avoid Clang -Wparentheses-equality
189  if (_Is_null)
191  if (get_id() == _STD this_thread::get_id())
193  if (_Thrd_join(_Thr, 0) != _Thrd_success)
196  }
Definition: xthread:22
#define _Thr_is_null(thr)
Definition: xthrcommon.h:40
_CRTIMP2_PURE int __cdecl _Thrd_join(_Thrd_t, int *)
Definition: xthreads.h:18
bool joinable() const _NOEXCEPT
Definition: thread:78
Definition: xthread:26
_CRTIMP2_PURE void __cdecl _Throw_Cpp_error(int _Code)
id get_id() const _NOEXCEPT
Definition: thread:198
_Thrd_t _Thr
Definition: thread:115
thread::id get_id() _NOEXCEPT
Definition: thread:203
Definition: xthread:23
#define _Thr_set_null(thr)
Definition: xthrcommon.h:39
bool thread::joinable ( ) const
inline
79  { // return true if this thread can be joined
80  return (!_Thr_is_null(_Thr));
81  }
#define _Thr_is_null(thr)
Definition: xthrcommon.h:40
_Thrd_t _Thr
Definition: thread:115
native_handle_type thread::native_handle ( )
inline
101  { // return Win32 HANDLE as void *
102  return (_Thr._Hnd);
103  }
void * _Hnd
Definition: xthrcommon.h:34
_Thrd_t _Thr
Definition: thread:115
thread& thread::operator= ( thread &&  _Other)
inline
66  { // move from _Other
67  return (_Move_thread(_Other));
68  }
thread & _Move_thread(thread &_Other)
Definition: thread:106
thread& thread::operator= ( const thread )
delete
void thread::swap ( thread _Other)
inline
74  { // swap with _Other
75  _STD swap(_Thr, _Other._Thr);
76  }
void swap(thread &_Other) _NOEXCEPT
Definition: thread:73
_Thrd_t _Thr
Definition: thread:115

Member Data Documentation

_Thrd_t thread::_Thr
private

The documentation for this class was generated from the following file: