48 Thread(
const std::string &name,
const std::string &sync_name);
57 virtual void thread_main()=0;
60 static PT(
Thread) bind_thread(
const std::string &name,
const std::string &sync_name);
62 INLINE
const std::string &get_sync_name()
const;
64 INLINE
int get_pstats_index()
const;
65 INLINE
int get_python_index()
const;
66 INLINE std::string get_unique_id()
const;
68 INLINE
int get_pipeline_stage()
const;
69 void set_pipeline_stage(
int pipeline_stage);
70 INLINE
void set_min_pipeline_stage(
int min_pipeline_stage);
72 INLINE
static Thread *get_main_thread();
73 INLINE
static Thread *get_external_thread();
74 INLINE
static Thread *get_current_thread();
75 INLINE
static int get_current_pipeline_stage();
76 INLINE
static bool is_threading_supported();
77 INLINE
static bool is_true_threads();
78 INLINE
static bool is_simple_threads();
79 BLOCKING INLINE
static void sleep(
double seconds);
81 BLOCKING INLINE
static void force_yield();
82 BLOCKING INLINE
static void consider_yield();
84 virtual void output(std::ostream &out)
const;
85 void output_blocker(std::ostream &out)
const;
86 static void write_status(std::ostream &out);
88 INLINE
bool is_started()
const;
89 INLINE
bool is_joinable()
const;
91 bool start(ThreadPriority priority,
bool joinable);
92 BLOCKING INLINE
void join();
93 INLINE
void preempt();
97 INLINE
void set_python_index(
int index);
99 INLINE
static void prepare_for_exit();
101 MAKE_PROPERTY(sync_name, get_sync_name);
102 MAKE_PROPERTY(pstats_index, get_pstats_index);
103 MAKE_PROPERTY(python_index, get_python_index);
104 MAKE_PROPERTY(unique_id, get_unique_id);
105 MAKE_PROPERTY(pipeline_stage, get_pipeline_stage, set_pipeline_stage);
107 MAKE_PROPERTY(main_thread, get_main_thread);
108 MAKE_PROPERTY(external_thread, get_external_thread);
109 MAKE_PROPERTY(current_thread, get_current_thread);
110 MAKE_PROPERTY(current_pipeline_stage, get_current_pipeline_stage);
112 MAKE_PROPERTY(threading_supported, is_threading_supported);
113 MAKE_PROPERTY(true_threads, is_true_threads);
114 MAKE_PROPERTY(simple_threads, is_simple_threads);
116 MAKE_PROPERTY(started, is_started);
117 MAKE_PROPERTY(joinable, is_joinable);
118 MAKE_PROPERTY(current_task, get_current_task);
126 virtual void deactivate_hook(
Thread *thread);
127 virtual void activate_hook(
Thread *thread);
130 INLINE
void set_pstats_index(
int pstats_index);
135 INLINE JNIEnv *get_jni_env()
const;
139 static void init_main_thread();
140 static void init_external_thread();
146 std::string _sync_name;
152 AtomicAdjust::Pointer _current_task;
157 MutexDebug *_blocked_on_mutex;
158 ConditionVarDebug *_waiting_on_cvar;
159 ConditionVarFullDebug *_waiting_on_cvar_full;
163 static Thread *_main_thread;
164 static Thread *_external_thread;
170 static void init_type() {
171 TypedReferenceCount::init_type();
172 Namable::init_type(),
174 TypedReferenceCount::get_class_type(),
175 Namable::get_class_type());
178 return get_class_type();
180 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
185 friend class MutexDebug;
186 friend class ConditionVarDebug;
187 friend class ConditionVarFullDebug;
189 friend class ThreadDummyImpl;
190 friend class ThreadWin32Impl;
191 friend class ThreadPosixImpl;
192 friend class ThreadSimpleImpl;
The special "main thread" class.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...