17 #ifndef __TBB_tbb_thread_H 18 #define __TBB_tbb_thread_H 24 #define __TBB_NATIVE_THREAD_ROUTINE unsigned WINAPI 25 #define __TBB_NATIVE_THREAD_ROUTINE_PTR(r) unsigned (WINAPI* r)( void* ) 26 namespace tbb {
namespace internal {
27 #if __TBB_WIN8UI_SUPPORT 29 #else // __TBB_WIN8UI_SUPPORT 31 #endif // __TBB_WIN8UI_SUPPORT 34 #define __TBB_NATIVE_THREAD_ROUTINE void* 35 #define __TBB_NATIVE_THREAD_ROUTINE_PTR(r) void* (*r)( void* ) 37 namespace tbb {
namespace internal {
40 #endif // _WIN32||_WIN64 46 #include __TBB_STD_SWAP_HEADER 55 inline void swap( internal::tbb_thread_v3& t1, internal::tbb_thread_v3& t2 )
__TBB_NOEXCEPT(
true);
87 self->function(self->arg1);
100 self->function(self->arg1, self->arg2);
109 #if __TBB_IF_NO_COPY_CTOR_MOVE_SEMANTICS_BROKEN 121 #endif // _WIN32||_WIN64 128 #endif // _WIN32||_WIN64 133 typedef internal::thread_closure_0<F> closure_type;
138 typedef internal::thread_closure_1<F,X> closure_type;
139 internal_start(closure_type::start_routine,
new closure_type(f,x));
143 typedef internal::thread_closure_2<F,X,Y> closure_type;
144 internal_start(closure_type::start_routine,
new closure_type(f,x,y));
147 #if __TBB_CPP11_RVALUE_REF_PRESENT 151 , my_thread_id(x.my_thread_id)
163 #else // __TBB_CPP11_RVALUE_REF_PRESENT 168 #endif // __TBB_CPP11_RVALUE_REF_PRESENT 195 #endif // _WIN32||_WIN64 207 my_thread_id = x.my_thread_id;
208 #endif // _WIN32||_WIN64 234 template<
class charT,
class traits>
235 friend std::basic_ostream<charT, traits>&
245 __TBB_STATIC_ASSERT(
sizeof(
id.
my_id) <=
sizeof(
size_t),
"Implementation assumes that thread_id_type fits into machine word");
257 return id(my_thread_id);
260 #endif // _WIN32||_WIN64 270 return x.my_id == y.my_id;
274 return x.my_id != y.my_id;
278 return x.my_id < y.my_id;
282 return x.my_id <= y.my_id;
286 return x.my_id > y.my_id;
290 return x.my_id >= y.my_id;
298 using internal::operator==;
299 using internal::operator!=;
300 using internal::operator<;
301 using internal::operator>;
302 using internal::operator<=;
303 using internal::operator>=;
312 std::swap(t1.my_thread_id, t2.my_thread_id);
316 namespace this_tbb_thread {
bool operator>(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
friend bool operator<=(tbb_thread_v3::id x, tbb_thread_v3::id y) __TBB_NOEXCEPT(true)
bool joinable() const __TBB_NOEXCEPT(true)
friend void __TBB_EXPORTED_FUNC move_v3(tbb_thread_v3 &t1, tbb_thread_v3 &t2)
tbb_thread_v3::id __TBB_EXPORTED_FUNC thread_get_id_v3()
void sleep(const tick_count::interval_t &i)
The current thread blocks at least until the time specified.
size_t tbb_hasher(const T &t)
Hasher functions.
#define __TBB_NATIVE_THREAD_ROUTINE_PTR(r)
tbb_thread_v3(F f)
Constructs an object and executes f() in a new thread.
#define __TBB_EXPORTED_METHOD
void __TBB_EXPORTED_METHOD join()
The completion of the thread represented by *this happens before join() returns.
#define __TBB_NATIVE_THREAD_ROUTINE
friend bool operator<(tbb_thread_v3::id x, tbb_thread_v3::id y) __TBB_NOEXCEPT(true)
native_handle_type my_handle
tbb_thread_v3() __TBB_NOEXCEPT(true)
Constructs a thread object that does not represent a thread of execution.
friend bool operator==(tbb_thread_v3::id x, tbb_thread_v3::id y) __TBB_NOEXCEPT(true)
bool operator==(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
Structure used to pass user function with 1 argument to thread.
friend bool operator!=(tbb_thread_v3::id x, tbb_thread_v3::id y) __TBB_NOEXCEPT(true)
#define __TBB_EXPORTED_FUNC
tbb_thread_v3(F f, X x)
Constructs an object and executes f(x) in a new thread.
static __TBB_NATIVE_THREAD_ROUTINE start_routine(void *c)
Routine passed to Windows's _beginthreadex by thread::internal_start() inside tbb....
#define __TBB_STATIC_ASSERT(condition, msg)
id() __TBB_NOEXCEPT(true)
tbb_thread_v3(tbb_thread_v3 &&x) __TBB_NOEXCEPT(true)
void yield()
Offers the operating system the opportunity to schedule another thread.
pthread_t native_handle_type
thread_closure_0(const F &f)
static unsigned __TBB_EXPORTED_FUNC hardware_concurrency() __TBB_NOEXCEPT(true)
The number of hardware thread contexts.
internal::tbb_thread_v3 tbb_thread
Users reference thread class by name tbb_thread.
atomic< T > & as_atomic(T &t)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
#define __TBB_NOEXCEPT(expression)
id get_id() const __TBB_NOEXCEPT(true)
void move(tbb_thread &t1, tbb_thread &t2)
bool operator<(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
friend bool operator>=(tbb_thread_v3::id x, tbb_thread_v3::id y) __TBB_NOEXCEPT(true)
void __TBB_EXPORTED_FUNC move_v3(tbb_thread_v3 &t1, tbb_thread_v3 &t2)
friend tbb_thread_v3::id __TBB_EXPORTED_FUNC thread_get_id_v3()
thread_closure_2(const F &f, const X &x, const Y &y)
bool operator<=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
tbb_thread_v3(F f, X x, Y y)
Constructs an object and executes f(x,y) in a new thread.
void __TBB_EXPORTED_FUNC thread_sleep_v3(const tick_count::interval_t &i)
bool operator!=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
bool operator>=(const vector_iterator< Container, T > &i, const vector_iterator< Container, U > &j)
tbb_thread_v3 & operator=(tbb_thread_v3 &&x) __TBB_NOEXCEPT(true)
void *__TBB_EXPORTED_FUNC allocate_closure_v3(size_t size)
Allocate a closure.
thread_closure_1(const F &f, const X &x)
friend size_t tbb_hasher(const tbb_thread_v3::id &id)
friend bool operator>(tbb_thread_v3::id x, tbb_thread_v3::id y) __TBB_NOEXCEPT(true)
friend id atomic_compare_and_swap(id &location, const id &value, const id &comparand)
static __TBB_NATIVE_THREAD_ROUTINE start_routine(void *c)
void internal_wipe() __TBB_NOEXCEPT(true)
static __TBB_NATIVE_THREAD_ROUTINE start_routine(void *c)
Routine passed to Windows's _beginthreadex by thread::internal_start() inside tbb....
void __TBB_EXPORTED_FUNC thread_yield_v3()
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id id
void __TBB_EXPORTED_METHOD detach()
When detach() returns, *this no longer represents the possibly continuing thread of execution.
native_handle_type native_handle()
void swap(tbb_thread_v3 &t) __TBB_NOEXCEPT(true)
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
friend std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &out, tbb_thread_v3::id id)
void internal_move(tbb_thread_v3 &x) __TBB_NOEXCEPT(true)
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t size
void swap(internal::tbb_thread_v3 &t1, internal::tbb_thread_v3 &t2) __TBB_NOEXCEPT(true)
void __TBB_EXPORTED_METHOD internal_start(__TBB_NATIVE_THREAD_ROUTINE_PTR(start_routine), void *closure)
void __TBB_EXPORTED_FUNC free_closure_v3(void *)
Free a closure allocated by allocate_closure_v3.