ExternalThread

Inheritance:

Methods of ExternalThread:

Methods of Thread:

Methods of TypedReferenceCount:

Methods of TypedObject:

Methods of ReferenceCount:

getClassType
static TypeHandle ExternalThread::get_class_type(void);

Undocumented function.

bindThread
static PointerTo< Thread > Thread::bind_thread(string const &name, string const &sync_name);

Description: Returns a new Panda Thread object associated with the current thread (which has been created externally). This can be used to bind a unique Panda Thread object with an external thread, such as a new Python thread.
It is particularly useful to bind a Panda Thread object to an external thread for the purposes of PStats monitoring. Without this call, each external thread will be assigned the same global ExternalThread object, which means they will all appear in the same PStats graph.
It is the caller's responsibility to save the returned Thread pointer for the lifetime of the external thread. It is an error for the Thread pointer to destruct while the external thread is still in the system.
It is also an error to call this method from the main thread, or twice within a given thread, unless it is given the same name each time (in which case the same pointer will be returned each time).

considerYield
static void Thread::consider_yield(void);

Description: Possibly suspends the current thread for the rest of the current epoch, if it has run for enough this epoch. This is especially important for the simple thread implementation, which relies on cooperative yields like this.

forceYield
static void Thread::force_yield(void);

Description: Suspends the current thread for the rest of the current epoch.

getClassType
static TypeHandle Thread::get_class_type(void);

Undocumented function.

getCurrentPipelineStage
static int Thread::get_current_pipeline_stage(void);

Description: Returns the integer pipeline stage associated with the current thread. This is the same thing as get_current_thread()->get_pipeline_stage(), but it may be faster to retrieve in some contexts.

getCurrentThread
static Thread *Thread::get_current_thread(void);

Description: Returns a pointer to the currently-executing Thread object. If this is called from the main thread, this will return the same value as get_main_thread().
This will always return some valid Thread pointer. It will never return NULL, even if the current thread was spawned outside of Panda's threading system, although all non-Panda threads will return the exact same Thread pointer.

getExternalThread
static Thread *Thread::get_external_thread(void);

Description: Returns a pointer to the "external" Thread object--this is a special Thread object that corresponds to any thread spawned outside of Panda's threading interface. Note that multiple different threads may share this same pointer.

getMainThread
static Thread *Thread::get_main_thread(void);

Description: Returns a pointer to the "main" Thread object--this is the Thread that started the whole process.

getName
string const &Thread::get_name(void) const;

Description: Returns the name of the thread. Each thread should probably have a unique name, but this is not enforced (and not strictly required).

getPipelineStage
int Thread::get_pipeline_stage(void) const;

Description: Returns the Pipeline stage number associated with this thread. The default stage is 0 if no stage is specified otherwise. See set_pipeline_stage().

getPstatsIndex
int Thread::get_pstats_index(void) const;

Description: Returns the PStats index associated with this thread, or -1 if no index has yet been associated with this thread. This is used internally by the PStatClient; you should not need to call this directly.

getSyncName
string const &Thread::get_sync_name(void) const;

Description: Returns the sync name of the thread. This name collects threads into "sync groups", which are expected to run synchronously. This is mainly used for the benefit of PStats; threads with the same sync name can be ticked all at once via the thread_tick() call.

isStarted
bool Thread::is_started(void) const;

Description: Returns true if the thread has been started, false if it has not, or if join() has already been called.

isThreadingSupported
static bool Thread::is_threading_supported(void);

Description: Returns true if threading support has been compiled in and enabled, or false if no threading is available (and Thread::start() will always fail).

isTrueThreads
static bool Thread::is_true_threads(void);

Description: Returns true if a real threading library is available that supports actual OS-implemented threads, or false if the only threading we can provide is simulated user-space threading.

join
void Thread::join(void);

Description: Blocks the calling process until the thread terminates. If the thread has already terminated, this returns immediately.

output
virtual void Thread::output(ostream &out) const;

Description:

preempt
void Thread::preempt(void);

Description: Indicates that this thread should run as soon as possible, preemptying any other threads that may be scheduled to run. This may not be implemented on every platform.

prepareForExit
static void Thread::prepare_for_exit(void);

Description: Should be called by the main thread just before exiting the program, this blocks until any remaining thread cleanup has finished.

setMinPipelineStage
void Thread::set_min_pipeline_stage(int min_pipeline_stage);

Description: Sets this thread's pipeline stage number to at least the indicated value, unless it is already larger. See set_pipeline_stage().

setPipelineStage
void Thread::set_pipeline_stage(int pipeline_stage);

Description: Specifies the Pipeline stage number associated with this thread. The default stage is 0 if no stage is specified otherwise.
This must be a value in the range [0 .. pipeline->get_num_stages() - 1]. It specifies the values that this thread observes for all pipelined data. Typically, an application thread will leave this at 0, but a render thread may set it to 1 or 2 (to operate on the previous frame's data, or the second previous frame's data).

sleep
static void Thread::sleep(double seconds);

Description: Suspends the current thread for at least the indicated amount of time. It might be suspended for longer.

start
bool Thread::start(ThreadPriority priority, bool joinable);

Description: Starts the thread executing. It is only valid to call this once.
The thread will begin executing its thread_main() function, and will terminate when thread_main() returns.
priority is intended as a hint to the relative importance of this thread. This may be ignored by the thread implementation.
joinable should be set true if you intend to call join() to wait for the thread to terminate, or false if you don't care and you will never call join().
The return value is true if the thread is successfully started, false otherwise.

writeStatus
static void Thread::write_status(ostream &out);

Description:

getClassType
static TypeHandle TypedReferenceCount::get_class_type(void);

Undocumented function.

getClassType
static TypeHandle TypedObject::get_class_type(void);

Undocumented function.

getType
virtual TypeHandle TypedObject::get_type(void) const = 0;

Derived classes should override this function to return get_class_type().

getTypeIndex
int TypedObject::get_type_index(void) const;

Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType
bool TypedObject::is_exact_type(TypeHandle handle) const;

Description: Returns true if the current object is the indicated type exactly.

isOfType
bool TypedObject::is_of_type(TypeHandle handle) const;

Description: Returns true if the current object is or derives from the indicated type.

getClassType
static TypeHandle ReferenceCount::get_class_type(void);

Undocumented function.

getRefCount
int ReferenceCount::get_ref_count(void) const;

Description: Returns the current reference count.

ref
void ReferenceCount::ref(void) const;

Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity
bool ReferenceCount::test_ref_count_integrity(void) const;

Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero
bool ReferenceCount::test_ref_count_nonzero(void) const;

Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref
bool ReferenceCount::unref(void) const;

Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is true if the new reference count is nonzero, false if it is zero.