22 Thread(
const Thread ©) : _impl(this) {
32 operator = (
const Thread ©) {
73 return _impl.get_unique_id();
85 return _pipeline_stage;
108 if (_main_thread == (
Thread *)NULL) {
125 if (_external_thread == (
Thread *)NULL) {
126 init_external_thread();
128 return _external_thread;
146 TAU_PROFILE(
"Thread *Thread::get_current_thread()",
" ", TAU_USER);
149 #else // HAVE_THREADS
150 Thread *thread = ThreadImpl::get_current_thread();
151 if (thread == (
Thread *)NULL) {
155 #endif // HAVE_THREADS
168 TAU_PROFILE(
"int Thread::get_current_pipeline_stage()",
" ", TAU_USER);
169 #ifndef THREADED_PIPELINE
174 #endif // !THREADED_PIPELINE
186 if (!support_threads) {
189 return ThreadImpl::is_threading_supported();
202 if (!support_threads) {
205 return ThreadImpl::is_true_threads();
222 if (!support_threads) {
225 return ThreadImpl::is_simple_threads();
237 TAU_PROFILE(
"void Thread::sleep(double)",
" ", TAU_USER);
238 ThreadImpl::sleep(seconds);
249 TAU_PROFILE(
"void Thread::yield()",
" ", TAU_USER);
264 TAU_PROFILE(
"void Thread::consider_yield()",
" ", TAU_USER);
265 ThreadImpl::consider_yield();
299 TAU_PROFILE(
"void Thread::join()",
" ", TAU_USER);
330 return _current_task;
342 ThreadImpl::prepare_for_exit();
354 _pstats_index = pstats_index;
366 _pstats_callback = pstats_callback;
380 return _pstats_callback;
384 operator << (ostream &out,
const Thread &thread) {
void set_pstats_index(int pstats_index)
Stores a PStats index to be associated with this thread.
AsyncTaskBase * get_current_task() const
Returns the task currently executing on this thread (via the AsyncTaskManager), if any...
The abstract base class for AsyncTask.
PStatsCallback * get_pstats_callback() const
Returns the PStats callback associated with this thread, or NULL if no callback has yet been associat...
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 bool is_true_threads()
Returns true if a real threading library is available that supports actual OS-implemented threads...
const string & get_sync_name() const
Returns the sync name of the thread.
static void prepare_for_exit()
Should be called by the main thread just before exiting the program, this blocks until any remaining ...
static Thread * get_external_thread()
Returns a pointer to the "external" Thread object–this is a special Thread object that corresponds ...
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.
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
void preempt()
Indicates that this thread should run as soon as possible, preemptying any other threads that may be ...
static Thread * get_main_thread()
Returns a pointer to the "main" Thread object–this is the Thread that started the whole process...
string get_unique_id() const
Returns a string that is guaranteed to be unique to this thread, across all processes on the machine...
static bool is_threading_supported()
Returns true if threading support has been compiled in and enabled, or false if no threading is avail...
void set_pipeline_stage(int pipeline_stage)
Specifies the Pipeline stage number associated with this thread.
static bool is_simple_threads()
Returns true if Panda is currently compiled for "simple threads", which is to say, cooperative context switching only, reducing the need for quite so many critical section protections.
bool is_started() const
Returns true if the thread has been started, false if it has not, or if join() has already been calle...
void set_pstats_callback(PStatsCallback *pstats_callback)
Stores a PStats callback to be associated with this thread.
static void sleep(double seconds)
Suspends the current thread for at least the indicated amount of time.
int get_pstats_index() const
Returns the PStats index associated with this thread, or -1 if no index has yet been associated with ...
void join()
Blocks the calling process until the thread terminates.
A thread; that is, a lightweight process.
bool is_joinable() const
Returns the value of joinable that was passed to the start() call.
static int get_current_pipeline_stage()
Returns the integer pipeline stage associated with the current thread.
int get_pipeline_stage() const
Returns the Pipeline stage number associated with this thread.