Panda3D
|
A thread; that is, a lightweight process. More...
#include "thread.h"
Classes | |
class | PStatsCallback |
Public Member Functions | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
void | clear_name () |
Resets the Namable's name to empty. | |
virtual TypeHandle | force_init_type () |
int | get_best_parent_from_Set (const std::set< int > &) const |
AsyncTaskBase * | get_current_task () const |
Returns the task currently executing on this thread (via the AsyncTaskManager), if any, or NULL if the thread is not currently servicing a task. | |
const string & | get_name () const |
int | get_pipeline_stage () const |
Returns the Pipeline stage number associated with this thread. | |
PStatsCallback * | get_pstats_callback () const |
Returns the PStats callback associated with this thread, or NULL if no callback has yet been associated with this thread. | |
int | get_pstats_index () const |
Returns the PStats index associated with this thread, or -1 if no index has yet been associated with this thread. | |
int | get_ref_count () const |
Returns the current reference count. | |
const string & | get_sync_name () const |
Returns the sync name of the thread. | |
virtual TypeHandle | get_type () const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
string | get_unique_id () const |
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. | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_joinable () const |
Returns the value of joinable that was passed to the start() call. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
bool | is_started () const |
Returns true if the thread has been started, false if it has not, or if join() has already been called. | |
void | join () |
Blocks the calling process until the thread terminates. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
virtual void | output (ostream &out) const |
Outputs the Namable. | |
void | output_blocker (ostream &out) const |
Writes a description of the mutex or condition variable that this thread is blocked on. | |
void | preempt () |
Indicates that this thread should run as soon as possible, preemptying any other threads that may be scheduled to run. | |
void | ref () const |
Explicitly increments the reference count. | |
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. | |
void | set_name (const string &name) |
void | set_pipeline_stage (int pipeline_stage) |
Specifies the Pipeline stage number associated with this thread. | |
void | set_pstats_callback (PStatsCallback *pstats_callback) |
Stores a PStats callback to be associated with this thread. | |
void | set_pstats_index (int pstats_index) |
Stores a PStats index to be associated with this thread. | |
bool | start (ThreadPriority priority, bool joinable) |
Starts the thread executing. | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
virtual bool | unref () const |
Explicitly decrements the reference count. | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. | |
Static Public Member Functions | |
static void | consider_yield () |
Possibly suspends the current thread for the rest of the current epoch, if it has run for enough this epoch. | |
static void | force_yield () |
Suspends the current thread for the rest of the current epoch. | |
static TypeHandle | get_class_type () |
static int | get_current_pipeline_stage () |
Returns the integer pipeline stage associated with the current thread. | |
static Thread * | get_current_thread () |
Returns a pointer to the currently-executing Thread object. | |
static Thread * | get_external_thread () |
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. | |
static Thread * | get_main_thread () |
Returns a pointer to the "main" Thread object--this is the Thread that started the whole process. | |
static void | init_type () |
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. | |
static bool | is_threading_supported () |
Returns true if threading support has been compiled in and enabled, or false if no threading is available (and Thread::start() will always fail). | |
static bool | is_true_threads () |
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. | |
static void | prepare_for_exit () |
Should be called by the main thread just before exiting the program, this blocks until any remaining thread cleanup has finished. | |
static | PT (Thread) bind_thread(const string &name |
static void | sleep (double seconds) |
Suspends the current thread for at least the indicated amount of time. | |
static void | write_status (ostream &out) |
Public Attributes | |
static const string & | sync_name |
Protected Member Functions | |
Thread (const string &name, const string &sync_name) | |
Creates a new Thread object, but does not immediately start executing it. | |
bool | do_test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | do_test_ref_count_nonzero () const |
Returns true if the reference count is nonzero, false otherwise. | |
virtual void | thread_main ()=0 |
Protected Attributes | |
bool | _started |
Friends | |
class | AsyncTaskBase |
class | ConditionVarDebug |
class | ConditionVarFullDebug |
class | MainThread |
class | MutexDebug |
class | ThreadDummyImpl |
class | ThreadPosixImpl |
class | ThreadSimpleImpl |
class | ThreadWin32Impl |
A thread; that is, a lightweight process.
This is an abstract base class; to use it, you must subclass from it and redefine thread_main().
The thread itself will keep a reference count on the Thread object while it is running; when the thread returns from its root function, the Thread object will automatically be destructed if no other pointers are referencing it.
Thread::Thread | ( | const string & | name, |
const string & | sync_name | ||
) | [protected] |
Creates a new Thread object, but does not immediately start executing it.
This gives the caller a chance to store it in a PT(Thread) object, if desired, before the thread gets a chance to terminate and destruct itself.
Call start() to begin thread execution.
The name should be unique for each thread (though this is not enforced, and not strictly required). The sync_name can be shared between multiple different threads; threads that run synchronously with each other should be given the same sync_name, for the benefit of PStats.
Definition at line 46 of file thread.cxx.
TypedObject * TypedObject::as_typed_object | ( | ) | [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 99 of file typedObject.I.
const TypedObject * TypedObject::as_typed_object | ( | ) | const [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 110 of file typedObject.I.
void Namable::clear_name | ( | ) | [inline, inherited] |
void Thread::consider_yield | ( | ) | [inline, static] |
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.
Definition at line 263 of file thread.I.
Referenced by PartGroup::bind_hierarchy(), PartGroup::check_hierarchy(), Texture::do_load_one(), Texture::do_read_one(), DatagramInputFile::get_datagram(), PNMImage::quick_filter_from(), SceneGraphReducer::r_apply_attribs(), SceneGraphReducer::r_collect_vertex_data(), SceneGraphReducer::r_unify(), PNMReader::read_data(), VertexDataSaveFile::read_data(), DatagramInputFile::read_header(), BamReader::read_pointer(), SceneGraphReducer::remove_unused_vertices(), GraphicsEngine::render_frame(), and PNMWriter::write_data().
bool ReferenceCount::do_test_ref_count_integrity | ( | ) | const [protected, inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
Definition at line 29 of file referenceCount.cxx.
Referenced by ReferenceCount::do_test_ref_count_nonzero(), and ReferenceCount::test_ref_count_integrity().
bool ReferenceCount::do_test_ref_count_nonzero | ( | ) | const [protected, inherited] |
Returns true if the reference count is nonzero, false otherwise.
Definition at line 56 of file referenceCount.cxx.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by ReferenceCount::test_ref_count_nonzero().
void Thread::force_yield | ( | ) | [inline, static] |
Suspends the current thread for the rest of the current epoch.
Definition at line 248 of file thread.I.
Referenced by DatagramGeneratorNet::get_datagram(), ConnectionListener::process_incoming_data(), VertexDataSaveFile::read_data(), and GraphicsEngine::render_frame().
int Thread::get_current_pipeline_stage | ( | ) | [inline, static] |
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.
Definition at line 167 of file thread.I.
References get_current_thread(), and get_pipeline_stage().
Referenced by PartBundle::clear_control_effects(), DisplayRegion::compute_pixels(), DisplayRegion::compute_pixels_all_stages(), PartBundle::control_activated(), PartBundle::do_bind_anim(), DisplayRegion::set_active(), PartBundle::set_anim_blend_flag(), PartBundle::set_blend_type(), DisplayRegion::set_camera(), PartBundle::set_control_effect(), DisplayRegion::set_cube_map_index(), DisplayRegion::set_dimensions(), PartBundle::set_frame_blend_flag(), DisplayRegion::set_lens_index(), PartBundle::set_root_xform(), DisplayRegion::set_sort(), DisplayRegion::set_stereo_channel(), and PartBundle::xform().
AsyncTaskBase * Thread::get_current_task | ( | ) | const [inline] |
Returns the task currently executing on this thread (via the AsyncTaskManager), if any, or NULL if the thread is not currently servicing a task.
Thread * Thread::get_current_thread | ( | ) | [inline, static] |
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.
Definition at line 145 of file thread.I.
References get_external_thread(), and get_main_thread().
Referenced by GeomNode::add_geom(), GeomNode::add_geoms_from(), CharacterJoint::add_local_transform(), CharacterJoint::add_net_transform(), Geom::add_primitive(), TransformBlend::add_transform(), PandaNode::adjust_draw_mask(), PandaNode::apply_attribs_to_vertices(), GeomNode::apply_attribs_to_vertices(), PartBundleNode::apply_attribs_to_vertices(), GeomPrimitive::check_valid(), Geom::check_valid(), PandaNode::clear_attrib(), PandaNode::clear_effect(), Geom::clear_primitives(), DXGraphicsStateGuardian9::close_gsg(), DXGraphicsStateGuardian8::close_gsg(), GraphicsStateGuardian::close_gsg(), GeomVertexArrayData::compare_to(), PandaNode::copy_all_properties(), PandaNode::copy_tags(), RigidBodyCombiner::cull_callback(), GeomNode::decompose(), Geom::decompose_in_place(), PandaNode::disable_cull_callback(), GeomNode::do_premunge(), AsyncTaskChain::do_stop_threads(), AnimateVerticesRequest::do_task(), MayaPview::doIt(), Geom::doubleside_in_place(), JointVertexTransform::fillin(), GeomNode::finalize(), PartBundle::finalize(), GraphicsEngine::flip_frame(), DriveInterface::force_dgraph(), PartBundle::force_update(), get_current_pipeline_stage(), CycleDataWriter< CycleDataType >::get_current_thread(), CycleDataStageWriter< CycleDataType >::get_current_thread(), CycleDataStageReader< CycleDataType >::get_current_thread(), CycleDataReader< CycleDataType >::get_current_thread(), CycleDataLockedStageReader< CycleDataType >::get_current_thread(), CycleDataLockedReader< CycleDataType >::get_current_thread(), GeomPrimitive::get_first_vertex(), GeomPrimitive::get_index_stride(), GeomPrimitive::get_max_vertex(), GeomPrimitive::get_min_vertex(), PandaNode::get_net_draw_control_mask(), PandaNode::get_net_draw_show_mask(), GeomVertexData::get_num_bytes(), WorkingNodePath::get_num_nodes(), GeomPrimitive::get_num_primitives(), GeomVertexData::get_num_rows(), GeomPrimitive::get_num_vertices(), DisplayRegion::get_screenshot(), PStatThread::get_thread(), GeomPrimitive::get_vertex(), RenderAttrib::init_attribs(), TransformState::init_states(), RenderState::init_states(), RenderEffects::init_states(), GeomPrimitive::is_indexed(), JointVertexTransform::JointVertexTransform(), PandaFramework::main_loop(), GeomPrimitive::make_nonindexed(), Geom::make_nonindexed(), Geom::make_points_in_place(), TransformBlend::normalize_weights(), Geom::offset_vertices(), GraphicsEngine::open_windows(), NodePathComponent::output(), GeomPrimitive::pack_vertices(), PandaNode::prepare_scene(), BamReader::read_cdata(), VertexDataSaveFile::read_data(), GeomTransformer::register_vertices(), GraphicsEngine::remove_all_windows(), Geom::remove_primitive(), TransformBlend::remove_transform(), GraphicsEngine::remove_window(), GraphicsEngine::render_frame(), PandaNode::replace_node(), SheetNode::reset_bound(), RopeNode::reset_bound(), DXGraphicsStateGuardian9::reset_d3d_device(), DXGraphicsStateGuardian8::reset_d3d_device(), Geom::reverse_in_place(), Geom::rotate_in_place(), AsyncTaskChain::service_one_task(), GeomVertexData::set_array(), PandaNode::set_attrib(), PandaNode::set_bounds(), PandaNode::set_bounds_type(), PandaNode::set_cull_callback(), ClockObject::set_dt(), PandaNode::set_effect(), ClockObject::set_frame_rate(), PandaNode::set_internal_bounds(), PandaNode::set_into_collide_mask(), UserVertexTransform::set_matrix(), ClockObject::set_mode(), GeomVertexData::set_num_rows(), Geom::set_primitive(), UserVertexSlider::set_slider(), FrameRateMeter::set_text_pattern(), Geom::set_usage_hint(), Geom::set_vertex_data(), BamCache::store(), GraphicsEngine::sync_frame(), GeomTransformer::transform_vertices(), GeomVertexData::unclean_set_num_rows(), GeomNode::unify(), Geom::unify_in_place(), AsyncTask::unlock_and_do_task(), GeomDrawCallbackData::upcall(), DisplayRegionDrawCallbackData::upcall(), DisplayRegionCullCallbackData::upcall(), SceneGraphAnalyzerMeter::update(), FrameRateMeter::update(), PartBundle::update(), AnimControl::wait_pending(), and BamWriter::write_cdata().
Thread * Thread::get_external_thread | ( | ) | [inline, static] |
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.
Definition at line 124 of file thread.I.
Referenced by get_current_thread().
Thread * Thread::get_main_thread | ( | ) | [inline, static] |
Returns a pointer to the "main" Thread object--this is the Thread that started the whole process.
Definition at line 107 of file thread.I.
Referenced by get_current_thread(), RenderAttrib::init_attribs(), TransformState::init_states(), RenderState::init_states(), and RenderEffects::init_states().
int Thread::get_pipeline_stage | ( | ) | const [inline] |
Returns the Pipeline stage number associated with this thread.
The default stage is 0 if no stage is specified otherwise. See set_pipeline_stage().
Definition at line 84 of file thread.I.
Referenced by PandaNode::add_stashed(), NodePath::any_path(), NodePath::attach_new_node(), NodePath::detach_node(), NodePath::get_ancestor(), NodePath::get_child(), NodePath::get_children(), get_current_pipeline_stage(), NodePath::get_hidden_ancestor(), PandaNode::get_internal_vertices(), PandaNode::get_nested_vertices(), PandaNode::get_net_collide_mask(), PandaNode::get_net_draw_control_mask(), PandaNode::get_net_draw_show_mask(), NodePath::get_node(), WorkingNodePath::get_num_nodes(), NodePath::get_num_nodes(), NodePath::get_parent(), NodePath::get_sort(), NodePath::get_stashed_ancestor(), NodePath::get_stashed_children(), NodePath::get_top(), NodePath::instance_to(), NodePath::is_singleton(), NodePath::NodePath(), NodePathComponent::output(), PandaNode::remove_child(), NodePath::remove_node(), PandaNode::remove_stashed(), NodePath::reparent_to(), PandaNode::reset_all_prev_transform(), SheetNode::reset_bound(), RopeNode::reset_bound(), ClockObject::set_frame_count(), ClockObject::set_frame_rate(), ClockObject::set_frame_time(), ClockObject::set_mode(), NodePath::stash(), PandaNode::stash_child(), NodePath::stash_to(), ClockObject::tick(), NodePath::unstash(), PandaNode::unstash_child(), and NodePath::verify_complete().
Thread::PStatsCallback * Thread::get_pstats_callback | ( | ) | const [inline] |
Returns the PStats callback associated with this thread, or NULL if no callback has yet been associated with this thread.
This is used internally by the PStatClient; you should not need to call this directly.
int Thread::get_pstats_index | ( | ) | const [inline] |
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.
Definition at line 60 of file thread.I.
Referenced by PStatThread::PStatThread().
int ReferenceCount::get_ref_count | ( | ) | const [inline, inherited] |
Returns the current reference count.
Definition at line 155 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by TransformState::clear_cache(), RenderState::clear_cache(), RenderState::finalize(), RenderEffects::finalize(), RenderEffect::finalize(), RenderAttrib::finalize(), InternalName::finalize(), TransformState::get_num_unused_states(), RenderState::get_num_unused_states(), TransformState::list_cycles(), RenderState::list_cycles(), GeomVertexFormat::remove_column(), TransformState::unref(), RenderState::unref(), RenderState::~RenderState(), and TransformState::~TransformState().
const string & Thread::get_sync_name | ( | ) | const [inline] |
int TypedObject::get_type_index | ( | ) | const [inline, inherited] |
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().
Definition at line 52 of file typedObject.I.
References TypeHandle::get_index().
string Thread::get_unique_id | ( | ) | const [inline] |
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.
Definition at line 72 of file thread.I.
Referenced by BamCache::store().
WeakReferenceList * ReferenceCount::get_weak_list | ( | ) | const [inline, inherited] |
Returns the WeakReferenceList associated with this ReferenceCount object.
If there has never been a WeakReferenceList associated with this object, creates one now.
Definition at line 307 of file referenceCount.I.
Referenced by ReferenceCount::weak_ref().
bool Namable::has_name | ( | ) | const [inline, inherited] |
Returns true if the Namable has a nonempty name set, false if the name is empty.
Definition at line 75 of file namable.I.
Referenced by XFileNode::add_child(), EggComponentData::add_name(), Texture::do_read_dds_file(), Texture::do_read_one(), Character::fillin(), EggGroupUniquifier::get_category(), EggXfmSAnim::optimize(), NodePathComponent::output(), AsyncTask::output(), EggNamedObject::output(), EggSAnimData::write(), EggPrimitive::write_body(), ParametricCurveCollection::write_egg(), ParametricCurve::write_egg(), EggNamedObject::write_header(), XFileDataNodeTemplate::write_text(), and XFileDataDef::write_text().
bool ReferenceCount::has_weak_list | ( | ) | const [inline, inherited] |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
In general, this will be true if there was ever a WeakPointerTo created for this object (even if there is not any for it now).
Definition at line 294 of file referenceCount.I.
Referenced by ReferenceCount::weak_unref().
bool TypedObject::is_exact_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is the indicated type exactly.
Definition at line 74 of file typedObject.I.
References TypeHandle::get_name().
Referenced by GraphicsStateGuardian::async_reload_texture(), PortalNode::combine_with(), PandaNode::combine_with(), GeomNode::combine_with(), CollisionNode::combine_with(), Character::combine_with(), PGItem::cull_callback(), FactoryParams::get_param_of_type(), CollisionHandlerPusher::handle_entries(), SceneGraphReducer::r_flatten(), ConnectionWriter::send(), FltToEggLevelState::set_transform(), and VirtualFileSystem::unmount().
bool Thread::is_joinable | ( | ) | const [inline] |
bool TypedObject::is_of_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is or derives from the indicated type.
Definition at line 63 of file typedObject.I.
References TypeHandle::is_derived_from().
Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().
bool Thread::is_simple_threads | ( | ) | [inline, static] |
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.
bool Thread::is_started | ( | ) | const [inline] |
bool Thread::is_threading_supported | ( | ) | [inline, static] |
Returns true if threading support has been compiled in and enabled, or false if no threading is available (and Thread::start() will always fail).
Definition at line 185 of file thread.I.
Referenced by ConnectionReader::ConnectionReader(), ConnectionWriter::ConnectionWriter(), AsyncTaskChain::do_start_threads(), AsyncTaskChain::set_num_threads(), and GraphicsEngine::set_threading_model().
bool Thread::is_true_threads | ( | ) | [inline, static] |
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.
Definition at line 201 of file thread.I.
Referenced by GraphicsEngine::render_frame(), and NodePath::verify_complete().
void Thread::join | ( | ) | [inline] |
Blocks the calling process until the thread terminates.
If the thread has already terminated, this returns immediately.
Definition at line 298 of file thread.I.
Referenced by AsyncTaskChain::do_stop_threads().
void ReferenceCount::local_object | ( | ) | [inline, inherited] |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
This allows the object to be passed to functions that will increment and decrement the object's reference count temporarily, and it will prevent the object from being deleted (inappropriately), when the reference count returns to zero. It actually achieves this by setting a large positive value in the reference count field.
Definition at line 276 of file referenceCount.I.
Referenced by PGTop::cull_callback(), BoundingSphere::extend_by_hexahedron(), AsyncTaskManager::find_task(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().
void Thread::output | ( | ostream & | out | ) | const [virtual] |
Outputs the Namable.
This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.
Reimplemented from Namable.
Definition at line 172 of file thread.cxx.
void Thread::output_blocker | ( | ostream & | out | ) | const |
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.
Definition at line 185 of file thread.cxx.
void Thread::preempt | ( | ) | [inline] |
void Thread::prepare_for_exit | ( | ) | [inline, static] |
Should be called by the main thread just before exiting the program, this blocks until any remaining thread cleanup has finished.
Definition at line 341 of file thread.I.
Referenced by PandaFramework::close_framework(), and GraphicsEngine::remove_all_windows().
void ReferenceCount::ref | ( | ) | const [inline, inherited] |
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.
Definition at line 179 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_ref(), TypedWritable::decode_raw_from_bam_stream(), NodeCachedReferenceCount::node_ref(), NodeReferenceCount::node_ref(), BamCacheRecord::set_data(), CullableObject::set_draw_callback(), and ModelRoot::set_reference().
void Thread::set_min_pipeline_stage | ( | int | min_pipeline_stage | ) | [inline] |
Sets this thread's pipeline stage number to at least the indicated value, unless it is already larger.
See set_pipeline_stage().
Definition at line 96 of file thread.I.
References set_pipeline_stage().
void Thread::set_pipeline_stage | ( | int | pipeline_stage | ) |
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).
Definition at line 153 of file thread.cxx.
Referenced by set_min_pipeline_stage().
void Thread::set_pstats_callback | ( | Thread::PStatsCallback * | pstats_callback | ) | [inline] |
Stores a PStats callback to be associated with this thread.
This is used internally by the PStatClient; you should not need to call this directly.
void Thread::set_pstats_index | ( | int | pstats_index | ) | [inline] |
Stores a PStats index to be associated with this thread.
This is used internally by the PStatClient; you should not need to call this directly.
void Thread::sleep | ( | double | seconds | ) | [inline, static] |
Suspends the current thread for at least the indicated amount of time.
It might be suspended for longer.
Definition at line 236 of file thread.I.
Referenced by ModelLoadRequest::do_task(), TextureReloadRequest::do_task(), PStatServer::main_loop(), and MayaApi::MayaApi().
bool Thread::start | ( | ThreadPriority | priority, |
bool | joinable | ||
) |
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(). Note that the reference count on the Thread object is incremented while the thread itself is running, so if you just want to fire and forget a thread, you may pass joinable = false, and never store the Thread object. It will automatically destruct itself when it finishes.
The return value is true if the thread is successfully started, false otherwise.
Definition at line 237 of file thread.cxx.
bool ReferenceCount::test_ref_count_integrity | ( | ) | const [inline, inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
Definition at line 236 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by EggGroupNode::add_child(), InternalName::find_ancestor(), InternalName::get_ancestor(), ReferenceCount::get_ref_count(), InternalName::get_top(), ReferenceCount::ref(), EggVertex::test_gref_integrity(), EggVertex::test_pref_integrity(), EggNode::test_under_integrity(), EggPrimitive::test_vref_integrity(), EggGroup::test_vref_integrity(), MouseWatcher::throw_event_pattern(), ReferenceCount::unref(), and EggNode::update_under().
bool ReferenceCount::test_ref_count_nonzero | ( | ) | const [inline, inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
Definition at line 252 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_nonzero().
Referenced by CopyOnWritePointer::test_ref_count_nonzero().
bool ReferenceCount::unref | ( | ) | const [inline, virtual, inherited] |
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().
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.
Reimplemented in GeomVertexArrayFormat, GeomVertexFormat, InternalName, RenderAttrib, RenderEffects, RenderState, and TransformState.
Definition at line 214 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_unref(), TypedWritable::decode_raw_from_bam_stream(), RenderEffect::finalize(), NodeCachedReferenceCount::node_unref(), NodeReferenceCount::node_unref(), TransformState::unref(), RenderState::unref(), RenderEffects::unref(), RenderAttrib::unref(), InternalName::unref(), GeomVertexFormat::unref(), and GeomVertexArrayFormat::unref().
void ReferenceCount::weak_ref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Adds the indicated PointerToVoid as a weak reference to this object.
Definition at line 321 of file referenceCount.I.
References WeakReferenceList::add_reference(), and ReferenceCount::get_weak_list().
void ReferenceCount::weak_unref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Removes the indicated PointerToVoid as a weak reference to this object.
It must have previously been added via a call to weak_ref().
Definition at line 334 of file referenceCount.I.
References WeakReferenceList::clear_reference(), and ReferenceCount::has_weak_list().