Panda3D
Static Public Member Functions | List of all members
MainThread Class Reference

The special "main thread" class. There is one instance of these in the world, and it is returned by Thread::get_main_thread(). More...

Inheritance diagram for MainThread:
Thread TypedReferenceCount Namable TypedObject ReferenceCount MemoryBase MemoryBase MemoryBase

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from Thread
static Thread bindThread (str name, str sync_name)
 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. More...
 
static considerYield ()
 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. More...
 
static forceYield ()
 Suspends the current thread for the rest of the current epoch. More...
 
static TypeHandle getClassType ()
 
static int getCurrentPipelineStage ()
 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. More...
 
static Thread getCurrentThread ()
 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(). More...
 
static Thread getExternalThread ()
 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. More...
 
static Thread getMainThread ()
 Returns a pointer to the "main" Thread object–this is the Thread that started the whole process. More...
 
static bool isSimpleThreads ()
 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. This is not necessarily the opposite of "true threads", since one possible implementation of simple threads is via true threads with mutex protection to ensure only one runs at a time. More...
 
static bool isThreadingSupported ()
 Returns true if threading support has been compiled in and enabled, or false if no threading is available (and Thread::start() will always fail). More...
 
static bool isTrueThreads ()
 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. More...
 
static prepareForExit ()
 Should be called by the main thread just before exiting the program, this blocks until any remaining thread cleanup has finished. More...
 
static sleep (double seconds)
 Suspends the current thread for at least the indicated amount of time. It might be suspended for longer. More...
 
static writeStatus (Ostream out)
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from Namable
static TypeHandle getClassType ()
 

Additional Inherited Members

- Public Member Functions inherited from Thread
AsyncTaskBase getCurrentTask ()
 Returns the task currently executing on this thread (via the AsyncTaskManager), if any, or NULL if the thread is not currently servicing a task. More...
 
int getPipelineStage ()
 Returns the Pipeline stage number associated with this thread. The default stage is 0 if no stage is specified otherwise. See set_pipeline_stage(). More...
 
int getPstatsIndex ()
 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. More...
 
object getPythonData ()
 Returns the Python object that was set with set_python_data(). More...
 
str getSyncName ()
 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. More...
 
str getUniqueId ()
 Returns a string that is guaranteed to be unique to this thread, across all processes on the machine, during at least the lifetime of this process. More...
 
bool isJoinable ()
 Returns the value of joinable that was passed to the start() call. More...
 
bool isStarted ()
 Returns true if the thread has been started, false if it has not, or if join() has already been called. More...
 
 join ()
 Blocks the calling process until the thread terminates. If the thread has already terminated, this returns immediately. More...
 
 output (Ostream out)
 
 outputBlocker (Ostream out)
 Writes a description of the mutex or condition variable that this thread is blocked on. Writes nothing if there is no blocker, or if we are not in DEBUG_THREADS mode. More...
 
 preempt ()
 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. More...
 
 setMinPipelineStage (int min_pipeline_stage)
 Sets this thread's pipeline stage number to at least the indicated value, unless it is already larger. See set_pipeline_stage(). More...
 
 setPipelineStage (int pipeline_stage)
 Specifies the Pipeline stage number associated with this thread. The default stage is 0 if no stage is specified otherwise. More...
 
 setPythonData (object python_data)
 Sets an arbitrary Python object that may be associated with this thread object. This is just for the purposes of associated arbitrary Python data with the C++ object; other than managing the reference count, the C++ code does nothing with this object. More...
 
bool start (ThreadPriority priority, bool joinable)
 Starts the thread executing. It is only valid to call this once. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 Derived classes should override this function to return get_class_type(). More...
 
int getTypeIndex ()
 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(). More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 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. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
 
bool unref ()
 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.) However, see the helper function unref_delete(). More...
 
- Public Member Functions inherited from Namable
 __init__ (const Namable copy)
 
 __init__ (str initial_name)
 
 clearName ()
 Resets the Namable's name to empty. More...
 
str getName ()
 
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
Namable operator= (const Namable other)
 
 output (Ostream out)
 Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this. More...
 
 setName (str name)
 

Detailed Description

The special "main thread" class. There is one instance of these in the world, and it is returned by Thread::get_main_thread().

Member Function Documentation

◆ getClassType()

static TypeHandle getClassType ( )
static