31 get_pstats_index()
const {
41 get_python_index()
const {
49 INLINE std::string Thread::
50 get_unique_id()
const {
51 return _impl.get_unique_id();
59 get_pipeline_stage()
const {
60 #if !defined(_DEBUG) && defined(__has_builtin) && __has_builtin(__builtin_assume) 64 int pipeline_stage = _pipeline_stage;
65 __builtin_assume(pipeline_stage >= 0);
66 return pipeline_stage;
68 return _pipeline_stage;
87 if (_main_thread ==
nullptr) {
100 get_external_thread() {
101 if (_external_thread ==
nullptr) {
102 init_external_thread();
104 return _external_thread;
118 get_current_thread() {
119 TAU_PROFILE(
"Thread *Thread::get_current_thread()",
" ", TAU_USER);
122 #else // HAVE_THREADS 123 Thread *thread = ThreadImpl::get_current_thread();
124 if (thread ==
nullptr) {
128 #endif // HAVE_THREADS 137 get_current_pipeline_stage() {
138 TAU_PROFILE(
"int Thread::get_current_pipeline_stage()",
" ", TAU_USER);
139 #ifndef THREADED_PIPELINE 144 #endif // !THREADED_PIPELINE 152 is_threading_supported() {
153 if (!support_threads) {
156 return ThreadImpl::is_threading_supported();
166 if (!support_threads) {
169 return ThreadImpl::is_true_threads();
180 is_simple_threads() {
181 if (!support_threads) {
184 return ThreadImpl::is_simple_threads();
193 TAU_PROFILE(
"void Thread::sleep(double)",
" ", TAU_USER);
194 ThreadImpl::sleep(seconds);
202 TAU_PROFILE(
"void Thread::yield()",
" ", TAU_USER);
213 TAU_PROFILE(
"void Thread::consider_yield()",
" ", TAU_USER);
214 ThreadImpl::consider_yield();
230 is_joinable()
const {
240 TAU_PROFILE(
"void Thread::join()",
" ", TAU_USER);
265 get_current_task()
const {
275 _python_index = python_index;
284 ThreadImpl::prepare_for_exit();
292 INLINE JNIEnv *Thread::
293 get_jni_env()
const {
294 return _impl.get_jni_env();
304 _pstats_index = pstats_index;
313 _pstats_callback = pstats_callback;
323 return _pstats_callback;
326 INLINE std::ostream &
327 operator << (std::ostream &out,
const Thread &thread) {
get_external_thread
Returns a pointer to the "external" Thread object–this is a special Thread object that corresponds to...
void set_pstats_index(int pstats_index)
Stores a PStats index to be associated with this thread.
void set_python_index(int index)
Stores a Python index to be associated with this thread.
void set_min_pipeline_stage(int min_pipeline_stage)
Sets this thread's pipeline stage number to at least the indicated value, unless it is already larger...
static void prepare_for_exit()
Should be called by the main thread just before exiting the program, this blocks until any remaining ...
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
static void consider_yield()
Possibly suspends the current thread for the rest of the current epoch, if it has run for enough this...
static void force_yield()
Suspends the current thread for the rest of the current epoch.
PStatsCallback * get_pstats_callback() const
Returns the PStats callback associated with this thread, or NULL if no callback has yet been associat...
void preempt()
Indicates that this thread should run as soon as possible, preemptying any other threads that may be ...
get_current_thread
Returns a pointer to the currently-executing Thread object.
void set_pstats_callback(PStatsCallback *pstats_callback)
Stores a PStats callback to be associated with this thread.
get_main_thread
Returns a pointer to the "main" Thread object–this is the Thread that started the whole process.
static void sleep(double seconds)
Suspends the current thread for at least the indicated amount of time.
set_pipeline_stage
Specifies the Pipeline stage number associated with this thread.
void join()
Blocks the calling process until the thread terminates.
A thread; that is, a lightweight process.
get_sync_name
Returns the sync name of the thread.