Intel(R) Threading Building Blocks Doxygen Documentation
version 4.2.3
|
Go to the documentation of this file.
17 #include "../rml/include/rml_tbb.h"
18 #include "../rml/server/thread_monitor.h"
25 using rml::internal::thread_monitor;
103 #if _MSC_VER && !defined(__INTEL_COMPILER)
105 #pragma warning(push)
106 #pragma warning(disable:4510 4610)
114 #if _MSC_VER && !defined(__INTEL_COMPILER)
148 atomic<int> my_net_slack_requests;
170 my_client.acknowledge_close_connection();
199 void register_master ( ::rml::server::execution_resource_t& )
__TBB_override {}
200 void unregister_master ( ::rml::server::execution_resource_t )
__TBB_override {}
207 #if _MSC_VER && !defined(__INTEL_COMPILER)
209 #pragma warning(push)
210 #pragma warning(disable:4189)
212 #if __MINGW32__ && __GNUC__==4 &&__GNUC_MINOR__>=2 && !__MINGW64__
214 __attribute__((force_align_arg_pointer))
218 AVOID_64K_ALIASING( self->my_index );
222 #if _MSC_VER && !defined(__INTEL_COMPILER)
228 thread_monitor::join(handle);
230 thread_monitor::detach_thread(handle);
263 ::rml::job& j = *
my_client.create_one_job();
268 thread_monitor::cookie c;
321 my_n_thread(client.max_job_count()),
322 my_stack_size(client.min_stack_size()),
323 my_thread_array(NULL)
328 my_net_slack_requests = 0;
348 asleep_list_mutex_type::scoped_lock
lock;
371 if( additional_slack>0 ) {
380 if( old<=0 )
goto done;
381 }
while(
my_slack.compare_and_swap(old-1,old)!=old );
386 if( additional_slack ) {
401 my_net_slack_requests+=delta;
405 }
else if( delta>0 ) {
unsigned default_concurrency() const __TBB_override
void yield() __TBB_override
void propagate_chain_reaction()
Wake up to two sleeping workers, if there are any sleeping.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
@ st_quit
Associated thread has ended normal life sequence and promises to never touch *this again.
static unsigned default_num_threads()
void poison_pointer(T *__TBB_atomic &)
void request_close_connection(bool) __TBB_override
void independent_thread_number_changed(int) __TBB_override
version_type version() const __TBB_override
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
void deallocate(pointer p, size_type)
Free block of memory that starts on a cache line.
state_t
State in finite-state machine that controls the worker.
tbb_client & my_client
Associated client.
asleep_list_mutex_type my_asleep_list_mutex
tbb_server * make_private_server(tbb_client &client)
Factory method called from task.cpp to create a private_server.
void run()
Actions executed by the associated thread.
void protect_affinity_mask(bool)
static const size_t cache_line_size
private_server(tbb_client &client)
void start_shutdown()
Called by a thread (usually not the associated thread) to commence termination.
thread_monitor my_thread_monitor
Monitor for sleeping when there is no work to do.
thread_monitor::handle_type thread_handle
private_worker * my_next
Link for list of workers that are sleeping or have no associated thread.
atomic< state_t > my_state
padded_private_worker * my_thread_array
void adjust_job_count_estimate(int delta) __TBB_override
static bool does_client_join_workers(const tbb::internal::rml::tbb_client &client)
thread_handle my_handle
Handle of the OS thread associated with this worker.
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 * lock
const size_t NFS_MaxLineSize
Compile-time constant that is upper bound on cache line/sector size.
atomic< int > my_slack
Number of jobs that could use their associated thread minus number of active threads.
Base class for types that should not be copied or assigned.
atomic< int > my_ref_count
Counter used to determine when to delete this.
const size_t my_index
index used for avoiding the 64K aliasing problem
void const char const char int ITT_FORMAT __itt_group_sync s
char pad[cache_line_size - sizeof(private_worker)%cache_line_size]
void suppress_unused_warning(const T1 &)
Utility template function to prevent "unused" warnings by various compilers.
static void release_handle(thread_handle my_handle, bool join)
bool try_insert_in_asleep_list(private_worker &t)
Try to add t to list of sleeping workers.
private_server & my_server
Associated server.
@ st_init
*this is initialized
void wake_some(int additional_slack)
Equivalent of adding additional_slack to my_slack and waking up to 2 threads if my_slack permits.
void wake_or_launch()
Wake up associated thread (or launch a thread if there is none)
private_worker(private_server &server, tbb_client &client, const size_t i)
pointer allocate(size_type n, const void *hint=0)
Allocate space for n objects, starting on a cache/sector line.
__TBB_SCHEDULER_MUTEX_TYPE scheduler_mutex_type
Mutex type for global locks in the scheduler.
scheduler_mutex_type asleep_list_mutex_type
Protects my_asleep_list_root.
virtual ~private_server()
const tbb_client::size_type my_n_thread
Maximum number of threads to be created.
static __RML_DECL_THREAD_ROUTINE thread_routine(void *arg)
const size_t my_stack_size
Stack size for each thread. */.
tbb::atomic< private_worker * > my_asleep_list_root
List of workers that are asleep or committed to sleeping until notified by another thread.
@ st_starting
*this has associated thread that is starting up.
padded_private_worker(private_server &server, tbb_client &client, const size_t i)
@ st_normal
Associated thread is doing normal life sequence.
Copyright © 2005-2020 Intel Corporation. All Rights Reserved.
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
* Other names and brands may be claimed as the property of others.