|
From: <br...@us...> - 2008-11-09 05:24:58
|
Revision: 3763
http://openvrml.svn.sourceforge.net/openvrml/?rev=3763&view=rev
Author: braden
Date: 2008-11-09 05:24:53 +0000 (Sun, 09 Nov 2008)
Log Message:
-----------
Acquire a read lock on the scene pointer mutex when rendering a node.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/libopenvrml/openvrml/node.cpp
trunk/src/libopenvrml/openvrml/node.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-11-06 07:55:28 UTC (rev 3762)
+++ trunk/ChangeLog 2008-11-09 05:24:53 UTC (rev 3763)
@@ -1,3 +1,27 @@
+2008-11-09 Braden McDaniel <br...@en...>
+
+ Acquire a read lock on the scene pointer mutex when rendering a
+ node.
+
+ * src/libopenvrml/openvrml/node.cpp
+ (openvrml::node::scene_mutex()): Get the scene pointer mutex.
+ (openvrml::appearance_node::render_appearance(viewer &,
+ rendering_context)): Acquire a read lock on the scene pointer
+ mutex.
+ (openvrml::child_node::render_child(viewer &, rendering_context)):
+ Acquire a read lock on the scene pointer mutex.
+ (openvrml::geometry_node::render_geometry(viewer &,
+ rendering_context)): Acquire a read lock on the scene pointer
+ mutex.
+ (openvrml::scoped_light_node::render_scoped_light(viewer &)):
+ Acquire a read lock on the scene pointer mutex.
+ (openvrml::texture_node::render_texture(viewer &)): Acquire a read
+ lock on the scene pointer mutex.
+ (openvrml::texture_transform_node::render_texture_transform(viewer&)):
+ Acquire a read lock on the scene pointer mutex.
+ * src/libopenvrml/openvrml/node.h
+ (openvrml::node): Added protected accessor for the scene mutex.
+
2008-11-03 Braden McDaniel <br...@en...>
Only render a node if the scene pointer is nonnull (i.e., the node
Modified: trunk/src/libopenvrml/openvrml/node.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/node.cpp 2008-11-06 07:55:28 UTC (rev 3762)
+++ trunk/src/libopenvrml/openvrml/node.cpp 2008-11-09 05:24:53 UTC (rev 3763)
@@ -2589,6 +2589,16 @@
emitter.emit_event(timestamp);
}
+/**
+ * @brief The @c scene mutex.
+ *
+ * @return the @c scene mutex.
+ */
+openvrml::read_write_mutex & openvrml::node::scene_mutex()
+{
+ return this->scene_mutex_;
+}
+
namespace {
struct OPENVRML_LOCAL field_printer_ {
field_printer_(const openvrml::node & node,
@@ -3113,6 +3123,7 @@
void openvrml::appearance_node::render_appearance(viewer & v,
rendering_context context)
{
+ read_write_mutex::scoped_read_lock lock(this->scene_mutex());
if (this->scene()) {
this->do_render_appearance(v, context);
this->modified(false);
@@ -3380,6 +3391,7 @@
void openvrml::child_node::render_child(viewer & v,
const rendering_context context)
{
+ read_write_mutex::scoped_read_lock lock(this->scene_mutex());
if (this->scene()) {
this->do_render_child(v, context);
this->modified(false);
@@ -3742,6 +3754,7 @@
openvrml::geometry_node::render_geometry(viewer & v,
rendering_context context)
{
+ read_write_mutex::scoped_read_lock lock(this->scene_mutex());
if (this->scene()) {
boost::mutex::scoped_lock lock(this->geometry_reference_mutex_);
@@ -4352,6 +4365,7 @@
*/
void openvrml::scoped_light_node::render_scoped_light(viewer & v)
{
+ read_write_mutex::scoped_read_lock lock(this->scene_mutex());
if (this->scene()) {
this->do_render_scoped_light(v);
}
@@ -4470,6 +4484,7 @@
openvrml::viewer::texture_object_t
openvrml::texture_node::render_texture(viewer & v)
{
+ read_write_mutex::scoped_read_lock lock(this->scene_mutex());
if (this->scene()) {
boost::mutex::scoped_lock lock(this->texture_reference_mutex_);
@@ -4620,6 +4635,7 @@
*/
void openvrml::texture_transform_node::render_texture_transform(viewer & v)
{
+ read_write_mutex::scoped_read_lock lock(this->scene_mutex());
if (this->scene()) {
this->do_render_texture_transform(v);
this->modified(false);
Modified: trunk/src/libopenvrml/openvrml/node.h
===================================================================
--- trunk/src/libopenvrml/openvrml/node.h 2008-11-06 07:55:28 UTC (rev 3762)
+++ trunk/src/libopenvrml/openvrml/node.h 2008-11-09 05:24:53 UTC (rev 3763)
@@ -552,6 +552,8 @@
const boost::shared_ptr<openvrml::scope> & scope)
OPENVRML_NOTHROW;
+ read_write_mutex & scene_mutex();
+
private:
virtual void do_initialize(double timestamp)
OPENVRML_THROW1(std::bad_alloc);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|