Go to the documentation of this file.
51 return _impl.get_unique_id();
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) {
101 if (_external_thread ==
nullptr) {
102 init_external_thread();
104 return _external_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
138 TAU_PROFILE(
"int Thread::get_current_pipeline_stage()",
" ", TAU_USER);
139 #ifndef THREADED_PIPELINE
144 #endif // !THREADED_PIPELINE
153 if (!support_threads) {
156 return ThreadImpl::is_threading_supported();
166 if (!support_threads) {
169 return ThreadImpl::is_true_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();
240 TAU_PROFILE(
"void Thread::join()",
" ", TAU_USER);
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) {
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.
is_true_threads
Returns true if a real threading library is available that supports actual OS-implemented threads,...
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.
static void consider_yield()
Possibly suspends the current thread for the rest of the current epoch, if it has run for enough this...
PStatsCallback * get_pstats_callback() const
Returns the PStats callback associated with this thread, or NULL if no callback has yet been associat...
void join()
Blocks the calling process until the thread terminates.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
get_python_index
Returns the Python index associated with this thread, or -1 if no index has yet been associated with ...
get_unique_id
Returns a string that is guaranteed to be unique to this thread, across all processes on the machine,...
get_current_thread
Returns a pointer to the currently-executing Thread object.
void set_pstats_index(int pstats_index)
Stores a PStats index to be associated with this thread.
is_simple_threads
Returns true if Panda is currently compiled for "simple threads", which is to say,...
is_threading_supported
Returns true if threading support has been compiled in and enabled, or false if no threading is avail...
get_current_task
Returns the task currently executing on this thread (via the AsyncTaskManager), if any,...
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...
void set_python_index(int index)
Stores a Python index to be associated with this thread.
static void prepare_for_exit()
Should be called by the main thread just before exiting the program, this blocks until any remaining ...
is_joinable
Returns the value of joinable that was passed to the start() call.
get_pstats_index
Returns the PStats index associated with this thread, or -1 if no index has yet been associated with ...
get_current_pipeline_stage
Returns the integer pipeline stage associated with the current thread.
get_sync_name
Returns the sync name of the thread.
get_pipeline_stage
Returns the Pipeline stage number associated with this thread.
void preempt()
Indicates that this thread should run as soon as possible, preemptying any other threads that may be ...
get_external_thread
Returns a pointer to the "external" Thread object–this is a special Thread object that corresponds to...
A thread; that is, a lightweight process.
static void force_yield()
Suspends the current thread for the rest of the current epoch.
is_started
Returns true if the thread has been started, false if it has not, or if join() has already been calle...