00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 INLINE Thread::
00022 Thread(const Thread ©) : _impl(this) {
00023 nassertv(false);
00024 }
00025
00026
00027
00028
00029
00030
00031 INLINE void Thread::
00032 operator = (const Thread ©) {
00033 nassertv(false);
00034 }
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 INLINE const string &Thread::
00047 get_sync_name() const {
00048 return _sync_name;
00049 }
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 INLINE int Thread::
00060 get_pstats_index() const {
00061 return _pstats_index;
00062 }
00063
00064
00065
00066
00067
00068
00069
00070
00071 INLINE string Thread::
00072 get_unique_id() const {
00073 return _impl.get_unique_id();
00074 }
00075
00076
00077
00078
00079
00080
00081
00082
00083 INLINE int Thread::
00084 get_pipeline_stage() const {
00085 return _pipeline_stage;
00086 }
00087
00088
00089
00090
00091
00092
00093
00094
00095 INLINE void Thread::
00096 set_min_pipeline_stage(int min_pipeline_stage) {
00097 set_pipeline_stage(max(_pipeline_stage, min_pipeline_stage));
00098 }
00099
00100
00101
00102
00103
00104
00105
00106 INLINE Thread *Thread::
00107 get_main_thread() {
00108 if (_main_thread == (Thread *)NULL) {
00109 init_main_thread();
00110 }
00111 return _main_thread;
00112 }
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123 INLINE Thread *Thread::
00124 get_external_thread() {
00125 if (_external_thread == (Thread *)NULL) {
00126 init_external_thread();
00127 }
00128 return _external_thread;
00129 }
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144 INLINE Thread *Thread::
00145 get_current_thread() {
00146 TAU_PROFILE("Thread *Thread::get_current_thread()", " ", TAU_USER);
00147 #ifndef HAVE_THREADS
00148 return get_main_thread();
00149 #else // HAVE_THREADS
00150 Thread *thread = ThreadImpl::get_current_thread();
00151 if (thread == (Thread *)NULL) {
00152 return Thread::get_external_thread();
00153 }
00154 return thread;
00155 #endif // HAVE_THREADS
00156 }
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 INLINE int Thread::
00167 get_current_pipeline_stage() {
00168 TAU_PROFILE("int Thread::get_current_pipeline_stage()", " ", TAU_USER);
00169 #ifndef THREADED_PIPELINE
00170
00171 return 0;
00172 #else
00173 return get_current_thread()->get_pipeline_stage();
00174 #endif // !THREADED_PIPELINE
00175 }
00176
00177
00178
00179
00180
00181
00182
00183
00184 INLINE bool Thread::
00185 is_threading_supported() {
00186 if (!support_threads) {
00187 return false;
00188 }
00189 return ThreadImpl::is_threading_supported();
00190 }
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200 INLINE bool Thread::
00201 is_true_threads() {
00202 if (!support_threads) {
00203 return false;
00204 }
00205 return ThreadImpl::is_true_threads();
00206 }
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220 INLINE bool Thread::
00221 is_simple_threads() {
00222 if (!support_threads) {
00223 return false;
00224 }
00225 return ThreadImpl::is_simple_threads();
00226 }
00227
00228
00229
00230
00231
00232
00233
00234
00235 INLINE void Thread::
00236 sleep(double seconds) {
00237 TAU_PROFILE("void Thread::sleep(double)", " ", TAU_USER);
00238 ThreadImpl::sleep(seconds);
00239 }
00240
00241
00242
00243
00244
00245
00246
00247 INLINE void Thread::
00248 force_yield() {
00249 TAU_PROFILE("void Thread::yield()", " ", TAU_USER);
00250 ThreadImpl::yield();
00251 }
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 INLINE void Thread::
00263 consider_yield() {
00264 TAU_PROFILE("void Thread::consider_yield()", " ", TAU_USER);
00265 ThreadImpl::consider_yield();
00266 }
00267
00268
00269
00270
00271
00272
00273
00274 INLINE bool Thread::
00275 is_started() const {
00276 return _started;
00277 }
00278
00279
00280
00281
00282
00283
00284
00285 INLINE bool Thread::
00286 is_joinable() const {
00287 return _joinable;
00288 }
00289
00290
00291
00292
00293
00294
00295
00296
00297 INLINE void Thread::
00298 join() {
00299 TAU_PROFILE("void Thread::join()", " ", TAU_USER);
00300 if (_started) {
00301 _impl.join();
00302 _started = false;
00303 }
00304 }
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314 INLINE void Thread::
00315 preempt() {
00316 if (_started) {
00317 _impl.preempt();
00318 }
00319 }
00320
00321
00322
00323
00324
00325
00326
00327
00328 INLINE AsyncTaskBase *Thread::
00329 get_current_task() const {
00330 return _current_task;
00331 }
00332
00333
00334
00335
00336
00337
00338
00339
00340 INLINE void Thread::
00341 prepare_for_exit() {
00342 ThreadImpl::prepare_for_exit();
00343 }
00344
00345
00346
00347
00348
00349
00350
00351
00352 INLINE void Thread::
00353 set_pstats_index(int pstats_index) {
00354 _pstats_index = pstats_index;
00355 }
00356
00357
00358
00359
00360
00361
00362
00363
00364 INLINE void Thread::
00365 set_pstats_callback(Thread::PStatsCallback *pstats_callback) {
00366 _pstats_callback = pstats_callback;
00367 }
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378 INLINE Thread::PStatsCallback *Thread::
00379 get_pstats_callback() const {
00380 return _pstats_callback;
00381 }
00382
00383 INLINE ostream &
00384 operator << (ostream &out, const Thread &thread) {
00385 thread.output(out);
00386 return out;
00387 }