Versioned thread class.
More...
#include <tbb_thread.h>
Versioned thread class.
Definition at line 122 of file tbb_thread.h.
◆ native_handle_type
◆ tbb_thread_v3() [1/6]
tbb::internal::tbb_thread_v3::tbb_thread_v3 |
( |
const tbb_thread_v3 & |
| ) |
|
|
private |
◆ tbb_thread_v3() [2/6]
tbb::internal::tbb_thread_v3::tbb_thread_v3 |
( |
| ) |
|
|
inline |
Constructs a thread object that does not represent a thread of execution.
Definition at line 139 of file tbb_thread.h.
142 #endif // _WIN32||_WIN64 native_handle_type my_handle
◆ tbb_thread_v3() [3/6]
template<class F >
tbb::internal::tbb_thread_v3::tbb_thread_v3 |
( |
F |
f | ) |
|
|
inlineexplicit |
Constructs an object and executes f() in a new thread.
Definition at line 146 of file tbb_thread.h.
147 typedef internal::thread_closure_0<F> closure_type;
void __TBB_EXPORTED_METHOD internal_start(__TBB_NATIVE_THREAD_ROUTINE_PTR(start_routine), void *closure)
◆ tbb_thread_v3() [4/6]
template<class F , class X >
tbb::internal::tbb_thread_v3::tbb_thread_v3 |
( |
F |
f, |
|
|
X |
x |
|
) |
| |
|
inline |
Constructs an object and executes f(x) in a new thread.
Definition at line 151 of file tbb_thread.h.
152 typedef internal::thread_closure_1<F,X> closure_type;
153 internal_start(closure_type::start_routine,
new closure_type(f,x));
void __TBB_EXPORTED_METHOD internal_start(__TBB_NATIVE_THREAD_ROUTINE_PTR(start_routine), void *closure)
◆ tbb_thread_v3() [5/6]
template<class F , class X , class Y >
tbb::internal::tbb_thread_v3::tbb_thread_v3 |
( |
F |
f, |
|
|
X |
x, |
|
|
Y |
y |
|
) |
| |
|
inline |
Constructs an object and executes f(x,y) in a new thread.
Definition at line 156 of file tbb_thread.h.
157 typedef internal::thread_closure_2<F,X,Y> closure_type;
158 internal_start(closure_type::start_routine,
new closure_type(f,x,y));
void __TBB_EXPORTED_METHOD internal_start(__TBB_NATIVE_THREAD_ROUTINE_PTR(start_routine), void *closure)
◆ tbb_thread_v3() [6/6]
tbb::internal::tbb_thread_v3::tbb_thread_v3 |
( |
tbb_thread_v3 && |
x | ) |
|
|
inline |
Definition at line 162 of file tbb_thread.h.
165 , my_thread_id(x.my_thread_id)
native_handle_type my_handle
◆ ~tbb_thread_v3()
tbb::internal::tbb_thread_v3::~tbb_thread_v3 |
( |
| ) |
|
|
inline |
◆ detach()
void tbb::internal::tbb_thread_v3::detach |
( |
| ) |
|
When detach() returns, *this no longer represents the possibly continuing thread of execution.
Definition at line 74 of file tbb_thread.cpp.
References tbb::internal::handle_perror(), tbb::internal::handle_win_error(), joinable(), and my_handle.
Referenced by tbb::internal::move_v3().
86 #endif // _WIN32||_WIN64 void __TBB_EXPORTED_FUNC handle_perror(int error_code, const char *aux_info)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
bool joinable() const __TBB_NOEXCEPT(true)
native_handle_type my_handle
void handle_win_error(int error_code)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
◆ get_id()
Definition at line 269 of file tbb_thread.h.
References __TBB_EXPORTED_FUNC, id, tbb::internal::move_v3(), tbb::internal::thread_get_id_v3(), tbb::internal::thread_sleep_v3(), and tbb::internal::thread_yield_v3().
Referenced by join().
271 return id(my_thread_id);
274 #endif // _WIN32||_WIN64 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
native_handle_type my_handle
◆ hardware_concurrency()
unsigned tbb::internal::tbb_thread_v3::hardware_concurrency |
( |
| ) |
|
|
static |
The number of hardware thread contexts.
Before TBB 3.0 U4 this methods returned the number of logical CPU in the system. Currently on Windows, Linux and FreeBSD it returns the number of logical CPUs available to the current process in accordance with its affinity mask.
NOTE: The return value of this method never changes after its first invocation. This means that changes in the process affinity mask that took place after this method was first invoked will not affect the number of worker threads in the TBB worker threads pool.
Definition at line 135 of file tbb_thread.cpp.
References tbb::internal::governor::default_num_threads().
static unsigned default_num_threads()
◆ internal_move()
◆ internal_start()
Runs start_routine(closure) on another thread and sets my_handle to the handle of the created thread.
Definition at line 90 of file tbb_thread.cpp.
References tbb::interface9::global_control::active_value(), tbb::internal::handle_perror(), my_handle, and tbb::interface9::global_control::thread_stack_size.
93 #if __TBB_WIN8UI_SUPPORT 94 std::thread* thread_tmp=
new std::thread(start_routine, closure);
99 my_thread_id = (size_t)thread_tmp;
105 start_routine, closure, 0, &thread_id );
110 my_thread_id = thread_id;
116 pthread_attr_t stack_size;
117 status = pthread_attr_init( &stack_size );
124 status = pthread_create( &thread_handle, &stack_size, start_routine, closure );
127 status = pthread_attr_destroy( &stack_size );
132 #endif // _WIN32||_WIN64 void __TBB_EXPORTED_FUNC handle_perror(int error_code, const char *aux_info)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
static size_t active_value(parameter p)
thread_monitor::handle_type thread_handle
native_handle_type my_handle
◆ internal_wipe()
void tbb::internal::tbb_thread_v3::internal_wipe |
( |
| ) |
|
|
inlineprivate |
◆ join()
void tbb::internal::tbb_thread_v3::join |
( |
| ) |
|
The completion of the thread represented by *this happens before join() returns.
Definition at line 46 of file tbb_thread.cpp.
References get_id(), tbb::this_tbb_thread::get_id(), tbb::internal::handle_perror(), tbb::internal::handle_win_error(), joinable(), and my_handle.
53 #if __TBB_WIN8UI_SUPPORT 54 std::thread* thread_tmp=(std::thread*)my_thread_id;
57 #else // __TBB_WIN8UI_SUPPORT 58 DWORD status = WaitForSingleObjectEx(
my_handle, INFINITE, FALSE );
59 if ( status == WAIT_FAILED )
61 BOOL close_stat = CloseHandle(
my_handle );
62 if ( close_stat == 0 )
65 #endif // __TBB_WIN8UI_SUPPORT 67 int status = pthread_join(
my_handle, NULL );
70 #endif // _WIN32||_WIN64 id get_id() const __TBB_NOEXCEPT(true)
void __TBB_EXPORTED_FUNC handle_perror(int error_code, const char *aux_info)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
__TBB_DEPRECATED_IN_VERBOSE_MODE tbb_thread::id get_id()
bool joinable() const __TBB_NOEXCEPT(true)
native_handle_type my_handle
void handle_win_error(int error_code)
Throws std::runtime_error with what() returning error_code description prefixed with aux_info...
◆ joinable()
bool tbb::internal::tbb_thread_v3::joinable |
( |
| ) |
const |
|
inline |
◆ native_handle()
◆ operator=() [1/2]
Definition at line 170 of file tbb_thread.h.
void internal_move(tbb_thread_v3 &x) __TBB_NOEXCEPT(true)
◆ operator=() [2/2]
◆ swap()
Definition at line 184 of file tbb_thread.h.
References tbb::swap().
void swap(concurrent_hash_map< Key, T, HashCompare, A > &a, concurrent_hash_map< Key, T, HashCompare, A > &b)
◆ move_v3
Definition at line 147 of file tbb_thread.cpp.
151 t1.my_handle = t2.my_handle;
154 t1.my_thread_id = t2.my_thread_id;
156 #endif // _WIN32||_WIN64
◆ tbb::swap
◆ my_handle
The documentation for this class was generated from the following files: