From: Braden M. <br...@us...> - 2007-06-01 05:34:10
|
Update of /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15889/src/libopenvrml/openvrml Modified Files: browser.cpp node.cpp node.h read_write_mutex.cpp read_write_mutex.h vrml97node.cpp Log Message: Removed node-wide recursive mutex. Index: read_write_mutex.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/read_write_mutex.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** read_write_mutex.cpp 15 May 2007 04:06:11 -0000 1.1 --- read_write_mutex.cpp 1 Jun 2007 05:34:02 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- #include "read_write_mutex.h" + #include <cassert> /** *************** *** 224,225 **** --- 225,284 ---- writing_(false) {} + + + /** + * @class openvrml::read_write_mutex::scoped_read_write_lock openvrml/read_write_lock.h + * + * @brief Lock the mutex for read/write access. + * + * Upon construction, the associated mutex is locked for reading. The lock + * can be “promoted” to a write lock by calling @c #promote. + */ + + /** + * @brief Construct. + * + * @param[in] mutex a @c read_write_mutex. + */ + openvrml::read_write_mutex::scoped_read_write_lock:: + scoped_read_write_lock(read_write_mutex & mutex): + scoped_read_lock(mutex) + {} + + /** + * @brief Destroy. + */ + openvrml::read_write_mutex::scoped_read_write_lock::~scoped_read_write_lock() + { + this->demote(); + } + + /** + * @brief Promote the lock to a write lock. + */ + void openvrml::read_write_mutex::scoped_read_write_lock::promote() + { + this->lock_.lock(); + assert(!this->mutex_.writing_); + if (this->mutex_.readers_active_ != 1) { + ++this->mutex_.writers_waiting_; + while (this->mutex_.readers_active_ != 1) { + this->mutex_.write_.wait(this->lock_); + } + --this->mutex_.writers_waiting_; + } + this->mutex_.writing_ = true; + this->lock_.unlock(); + } + + /** + * @brief Demote the lock from a write lock back to a read lock. + * + * If the lock has not previously been promoted, this function has no effect. + */ + void openvrml::read_write_mutex::scoped_read_write_lock::demote() + { + this->lock_.lock(); + this->mutex_.writing_ = false; + this->lock_.unlock(); + } Index: node.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/node.cpp,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** node.cpp 13 May 2007 00:46:34 -0000 1.92 --- node.cpp 1 Jun 2007 05:34:02 -0000 1.93 *************** *** 1760,1771 **** * @internal * - * @var boost::recursive_mutex openvrml::node::mutex_ - * - * @brief Object mutex. - */ - - /** - * @internal - * * @var const openvrml::node_type & openvrml::node::type_ * --- 1760,1763 ---- *************** *** 1786,1789 **** --- 1778,1789 ---- * @internal * + * @var openvrml::read_write_mutex openvrml::node::scene_mutex_ + * + * @brief Mutex protecting @c #scene_. + */ + + /** + * @internal + * * @var openvrml::scene * openvrml::node::scene_ * *************** *** 1794,1797 **** --- 1794,1805 ---- * @internal * + * @var openvrml::read_write_mutex openvrml::node::modified_mutex_ + * + * @brief Mutex protecting @c #modified_. + */ + + /** + * @internal + * * @var bool openvrml::node::modified_ * *************** *** 1982,1991 **** /** - * @fn openvrml::scene * openvrml::node::scene() const - * * @brief Get the scene with which the node is associated. * * @return the scene with which the node is associated. */ /** --- 1990,2003 ---- /** * @brief Get the scene with which the node is associated. * * @return the scene with which the node is associated. */ + openvrml::scene * openvrml::node::scene() const OPENVRML_NOTHROW + { + read_write_mutex::scoped_read_lock lock(this->scene_mutex_); + return this->scene_; + } + /** *************** *** 2007,2013 **** OPENVRML_THROW1(std::bad_alloc) { ! boost::recursive_mutex::scoped_lock lock(this->mutex_); if (!this->scene_) { this->scene_ = &scene; this->do_initialize(timestamp); --- 2019,2027 ---- OPENVRML_THROW1(std::bad_alloc) { ! read_write_mutex::scoped_read_write_lock lock(this->scene_mutex_); if (!this->scene_) { + lock.promote(); this->scene_ = &scene; + lock.demote(); this->do_initialize(timestamp); *************** *** 2142,2149 **** void openvrml::node::shutdown(const double timestamp) OPENVRML_NOTHROW { ! boost::recursive_mutex::scoped_lock lock(this->mutex_); if (this->scene_) { this->do_shutdown(timestamp); this->scene_ = 0; const node_interface_set & interfaces = this->type_.interfaces(); --- 2156,2165 ---- void openvrml::node::shutdown(const double timestamp) OPENVRML_NOTHROW { ! read_write_mutex::scoped_read_write_lock lock(this->scene_mutex_); if (this->scene_) { this->do_shutdown(timestamp); + lock.promote(); this->scene_ = 0; + lock.demote(); const node_interface_set & interfaces = this->type_.interfaces(); *************** *** 2514,2518 **** void openvrml::node::modified(const bool value) { ! boost::recursive_mutex::scoped_lock lock(this->mutex_); this->modified_ = value; if (this->modified_) { this->type_.metatype().browser().modified(true); } --- 2530,2534 ---- void openvrml::node::modified(const bool value) { ! read_write_mutex::scoped_write_lock lock(this->modified_mutex_); this->modified_ = value; if (this->modified_) { this->type_.metatype().browser().modified(true); } *************** *** 2530,2534 **** bool openvrml::node::modified() const { ! boost::recursive_mutex::scoped_lock lock(this->mutex_); return this->modified_; } --- 2546,2550 ---- bool openvrml::node::modified() const { ! read_write_mutex::scoped_read_lock lock(this->modified_mutex_); return this->modified_; } *************** *** 2549,2563 **** } - /** - * @fn boost::recursive_mutex & openvrml::node::mutex() const - * - * @brief Get the mutex associated with the @c node. - * - * Concrete node types should lock the @c node mutex when modifying field - * values outside the rendering thread. - * - * @return the mutex associated with the @c node. - */ - namespace { struct OPENVRML_LOCAL field_printer_ { --- 2565,2568 ---- *************** *** 2635,2639 **** const size_t indent) const { - boost::recursive_mutex::scoped_lock lock(this->mutex_); for (size_t i = 0; i < indent; ++i) { out << ' '; } std::string nodeId = this->id(); --- 2640,2643 ---- *************** *** 3087,3091 **** rendering_context context) { - boost::recursive_mutex::scoped_lock lock(this->mutex()); this->do_render_appearance(v, context); this->modified(false); --- 3091,3094 ---- *************** *** 3093,3100 **** /** ! * @brief render_appearance implementation. * ! * @param[in,out] v viewer. ! * @param[in] context rendering_context. */ void --- 3096,3103 ---- /** ! * @brief @c #render_appearance implementation. * ! * @param[in,out] v @c viewer. ! * @param[in] context @c rendering_context. */ void *************** *** 3103,3109 **** /** ! * @brief Cast to an appearance_node. * ! * @return a pointer to this appearance_node. */ openvrml::appearance_node * openvrml::appearance_node::to_appearance() --- 3106,3112 ---- /** ! * @brief Cast to an @c appearance_node. * ! * @return a pointer to this @c appearance_node. */ openvrml::appearance_node * openvrml::appearance_node::to_appearance() *************** *** 3118,3122 **** * @brief Get the material node associated with this appearance node. * ! * @return the material_node associated with this appearance_node. */ --- 3121,3125 ---- * @brief Get the material node associated with this appearance node. * ! * @return the @c material_node associated with this @c appearance_node. */ *************** *** 3126,3130 **** * @brief Get the texture node associated with this appearance node. * ! * @return the texture_node associated with this appearance_node. */ --- 3129,3133 ---- * @brief Get the texture node associated with this appearance node. * ! * @return the @c texture_node associated with this @c appearance_node. */ *************** *** 3134,3138 **** * @brief Get the texture transform node associated with this appearance node. * ! * @return the texture_transform_node associated with this appearance_node. */ --- 3137,3142 ---- * @brief Get the texture transform node associated with this appearance node. * ! * @return the @c texture_transform_node associated with this ! * @c appearance_node. */ *************** *** 3148,3151 **** --- 3152,3163 ---- * @internal * + * @var openvrml::read_write_mutex openvrml::bounded_volume_node::bounding_volume_dirty_mutex_ + * + * @brief Mutex protecting @c #bounding_volume_dirty_. + */ + + /** + * @internal + * * @var bool openvrml::bounded_volume_node::bounding_volume_dirty_ * *************** *** 3178,3186 **** * Nodes that have no bounding volume, or have a difficult to calculate * bvolume (like, say, Extrusion or Billboard) can just return an infinite ! * bsphere. Note that returning an infinite bvolume means that all the node's * ancestors will also end up with an infinite bvolume, and will never be * culled. * ! * Delegates to <code>bounded_volume_node::do_bounding_volume</code>. * * @return a maximized bounding volume. --- 3190,3198 ---- * Nodes that have no bounding volume, or have a difficult to calculate * bvolume (like, say, Extrusion or Billboard) can just return an infinite ! * bsphere. Note that returning an infinite bvolume means that all the node's * ancestors will also end up with an infinite bvolume, and will never be * culled. * ! * Delegates to @c #do_bounding_volume. * * @return a maximized bounding volume. *************** *** 3190,3193 **** --- 3202,3207 ---- { const openvrml::bounding_volume & bv = this->do_bounding_volume(); + read_write_mutex::scoped_write_lock + lock(this->bounding_volume_dirty_mutex_); this->bounding_volume_dirty_ = false; return bv; *************** *** 3195,3199 **** /** ! * @brief Called by <code>bounded_volume_node::bounding_volume</code>. * * @return a maximized bounding volume. --- 3209,3213 ---- /** ! * @brief Called by @c #bounding_volume. * * @return a maximized bounding volume. *************** *** 3227,3231 **** void openvrml::bounded_volume_node::bounding_volume_dirty(const bool value) { ! boost::recursive_mutex::scoped_lock lock(this->mutex()); this->bounding_volume_dirty_ = value; if (value) { // only if dirtying, not clearing --- 3241,3246 ---- void openvrml::bounded_volume_node::bounding_volume_dirty(const bool value) { ! read_write_mutex::scoped_write_lock ! lock(this->bounding_volume_dirty_mutex_); this->bounding_volume_dirty_ = value; if (value) { // only if dirtying, not clearing *************** *** 3242,3246 **** bool openvrml::bounded_volume_node::bounding_volume_dirty() const { ! boost::recursive_mutex::scoped_lock lock(this->mutex()); if (this->type().metatype().browser().flags_need_updating) { this->type().metatype().browser().update_flags(); --- 3257,3262 ---- bool openvrml::bounded_volume_node::bounding_volume_dirty() const { ! read_write_mutex::scoped_read_lock ! lock(this->bounding_volume_dirty_mutex_); if (this->type().metatype().browser().flags_need_updating) { this->type().metatype().browser().update_flags(); *************** *** 3299,3304 **** void openvrml::child_node::relocate() OPENVRML_THROW1(std::bad_alloc) { - boost::recursive_mutex::scoped_lock lock(this->mutex()); - typedef void (child_node::* Do_relocate)(); --- 3315,3318 ---- *************** *** 3346,3350 **** const rendering_context context) { - boost::recursive_mutex::scoped_lock lock(this->mutex()); this->do_render_child(v, context); this->modified(false); --- 3360,3363 ---- *************** *** 3644,3647 **** --- 3657,3670 ---- /** + * @internal + * + * @var boost::mutex openvrml::geometry_node::gemoetry_reference_mutex_ + * + * @brief Mutex protecting @c #geometry_reference. + */ + + /** + * @internal + * * @var openvrml::viewer::object_t openvrml::geometry_node::geometry_reference * *************** *** 3652,3657 **** * @brief Construct. * ! * @param[in] type the node_type associated with the node. ! * @param[in] scope the scope the node belongs to. */ openvrml::geometry_node:: --- 3675,3680 ---- * @brief Construct. * ! * @param[in] type the @c node_type associated with the @c node. ! * @param[in] scope the @c scope the @c node belongs to. */ openvrml::geometry_node:: *************** *** 3667,3674 **** * @brief Destroy. * ! * @todo Proper resource deallocation in the <code>viewer</code> depends on the ! * <code>viewer</code> <strong>not</strong> having been decoupled from ! * the browser. We need to handle this better via some refcounting ! * scheme. */ openvrml::geometry_node::~geometry_node() OPENVRML_NOTHROW --- 3690,3696 ---- * @brief Destroy. * ! * @todo Proper resource deallocation in the @c viewer depends on the ! * @c viewer @b not having been decoupled from the @c browser. We need ! * to handle this better via some refcounting scheme. */ openvrml::geometry_node::~geometry_node() OPENVRML_NOTHROW *************** *** 3698,3702 **** rendering_context context) { ! boost::recursive_mutex::scoped_lock lock(this->mutex()); if (this->geometry_reference != 0 && this->modified()) { --- 3720,3724 ---- rendering_context context) { ! boost::mutex::scoped_lock lock(this->geometry_reference_mutex_); if (this->geometry_reference != 0 && this->modified()) { *************** *** 3724,3728 **** bool openvrml::geometry_node::emissive() const OPENVRML_NOTHROW { - boost::recursive_mutex::scoped_lock lock(this->mutex()); return this->do_emissive(); } --- 3746,3749 ---- *************** *** 4294,4297 **** --- 4315,4328 ---- /** + * @internal + * + * @var boost::mutex openvrml::texture_node::texture_reference_mutex_ + * + * @brief Mutex protecting @c #texture_reference. + */ + + /** + * @internal + * * @var openvrml::viewer::texture_object_t openvrml::texture_node::texture_reference * *************** *** 4316,4323 **** * @brief Destroy. * ! * @todo Proper resource deallocation in the <code>viewer</code> depends on the ! * <code>viewer</code> <strong>not</strong> having been decoupled from ! * the browser. We need to handle this better via some refcounting ! * scheme. */ openvrml::texture_node::~texture_node() OPENVRML_NOTHROW --- 4347,4353 ---- * @brief Destroy. * ! * @todo Proper resource deallocation in the @c viewer depends on the ! * @c viewer @b not having been decoupled from the @c browser. We need ! * to handle this better via some refcounting scheme. */ openvrml::texture_node::~texture_node() OPENVRML_NOTHROW *************** *** 4334,4338 **** openvrml::texture_node::render_texture(viewer & v) { ! boost::recursive_mutex::scoped_lock lock(this->mutex()); if (this->texture_reference != 0 && this->modified()) { --- 4364,4368 ---- openvrml::texture_node::render_texture(viewer & v) { ! boost::mutex::scoped_lock lock(this->texture_reference_mutex_); if (this->texture_reference != 0 && this->modified()) { Index: node.h =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/node.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** node.h 13 May 2007 00:46:35 -0000 1.59 --- node.h 1 Jun 2007 05:34:02 -0000 1.60 *************** *** 449,456 **** mutable size_t ref_count_; - mutable boost::recursive_mutex mutex_; const node_type & type_; ! boost::shared_ptr<openvrml::scope> scope_; openvrml::scene * scene_; bool modified_; --- 449,459 ---- mutable size_t ref_count_; const node_type & type_; ! const boost::shared_ptr<openvrml::scope> scope_; ! ! mutable read_write_mutex scene_mutex_; openvrml::scene * scene_; + + mutable read_write_mutex modified_mutex_; bool modified_; *************** *** 514,519 **** OPENVRML_NOTHROW; - boost::recursive_mutex & mutex() const OPENVRML_NOTHROW; - private: virtual void do_initialize(double timestamp) --- 517,520 ---- *************** *** 598,610 **** } - inline openvrml::scene * node::scene() const OPENVRML_NOTHROW - { - return this->scene_; - } - - inline boost::recursive_mutex & node::mutex() const OPENVRML_NOTHROW - { - return this->mutex_; - } template <typename FieldValue> --- 599,602 ---- *************** *** 614,619 **** { boost::function_requires<FieldValueConcept<FieldValue> >(); - - boost::recursive_mutex::scoped_lock lock(this->mutex_); return dynamic_cast<const FieldValue &>(this->do_field(id)); } --- 606,609 ---- *************** *** 883,886 **** --- 873,877 ---- class OPENVRML_API bounded_volume_node : public virtual node { + mutable read_write_mutex bounding_volume_dirty_mutex_; mutable bool bounding_volume_dirty_; *************** *** 1003,1006 **** --- 994,998 ---- class OPENVRML_API geometry_node : public virtual bounded_volume_node { + boost::mutex geometry_reference_mutex_; viewer::object_t geometry_reference; *************** *** 1176,1179 **** --- 1168,1172 ---- class OPENVRML_API texture_node : public virtual node { + boost::mutex texture_reference_mutex_; viewer::texture_object_t texture_reference; Index: vrml97node.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/vrml97node.cpp,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** vrml97node.cpp 13 May 2007 06:47:28 -0000 1.129 --- vrml97node.cpp 1 Jun 2007 05:34:02 -0000 1.130 *************** *** 2504,2517 **** --- 2504,2528 ---- sftime_emitter bind_time_emitter_; + read_write_mutex front_mutex_; image front; bool front_needs_update; + + read_write_mutex back_mutex_; image back; bool back_needs_update; + + read_write_mutex left_mutex_; image left; bool left_needs_update; + + read_write_mutex right_mutex_; image right; bool right_needs_update; + + read_write_mutex top_mutex_; image top; bool top_needs_update; + + read_write_mutex bottom_mutex_; image bottom; bool bottom_needs_update; *************** *** 3040,3043 **** --- 3051,3055 ---- url_exposedfield url_; + read_write_mutex image_mutex_; openvrml::image image_; bool texture_needs_update; *************** *** 5568,5571 **** --- 5580,5591 ---- background.update_textures(); + read_write_mutex::scoped_read_lock + front_lock(background.front_mutex_), + back_lock(background.back_mutex_), + left_lock(background.left_mutex_), + right_lock(background.right_mutex_), + top_lock(background.top_mutex_), + bottom_lock(background.bottom_mutex_); + background.viewerObject = v.insert_background( *************** *** 5589,5600 **** * @brief Create a node_type. * ! * @param id the name for the new node_type. ! * @param interfaces the interfaces for the new node_type. * ! * @return a boost::shared_ptr<node_type> to a node_type capable of * creating Background nodes. * * @exception unsupported_interface if @p interfaces includes an interface ! * not supported by background_metatype. * @exception std::bad_alloc if memory allocation fails. */ --- 5609,5620 ---- * @brief Create a node_type. * ! * @param id the name for the new @c node_type. ! * @param interfaces the interfaces for the new @c node_type. * ! * @return a @c boost::shared_ptr<node_type> to a @c node_type capable of * creating Background nodes. * * @exception unsupported_interface if @p interfaces includes an interface ! * not supported by @c background_metatype. * @exception std::bad_alloc if memory allocation fails. */ *************** *** 6304,6308 **** const std::string uri_; ! boost::recursive_mutex & node_mutex_; openvrml::image & image_; openvrml::node & node_; --- 6324,6328 ---- const std::string uri_; ! openvrml::read_write_mutex & image_mutex_; openvrml::image & image_; openvrml::node & node_; *************** *** 6407,6411 **** openvrml::image & image, openvrml::node & node, ! boost::recursive_mutex & node_mutex); virtual ~image_stream_listener() OPENVRML_NOTHROW; --- 6427,6431 ---- openvrml::image & image, openvrml::node & node, ! openvrml::read_write_mutex & image_mutex); virtual ~image_stream_listener() OPENVRML_NOTHROW; *************** *** 6436,6441 **** *static_cast<png_reader_t *>(png_get_progressive_ptr(png_ptr)); ! boost::recursive_mutex::scoped_lock ! lock(reader.stream_listener.node_mutex_); openvrml::image & image = reader.stream_listener.image_; --- 6456,6461 ---- *static_cast<png_reader_t *>(png_get_progressive_ptr(png_ptr)); ! openvrml::read_write_mutex::scoped_write_lock ! lock(reader.stream_listener.image_mutex_); openvrml::image & image = reader.stream_listener.image_; *************** *** 6538,6543 **** *static_cast<png_reader_t *>(png_get_progressive_ptr(png_ptr)); ! boost::recursive_mutex::scoped_lock ! lock(reader.stream_listener.node_mutex_); openvrml::image & image = reader.stream_listener.image_; --- 6558,6563 ---- *static_cast<png_reader_t *>(png_get_progressive_ptr(png_ptr)); ! openvrml::read_write_mutex::scoped_write_lock ! lock(reader.stream_listener.image_mutex_); openvrml::image & image = reader.stream_listener.image_; *************** *** 6794,6799 **** do_read(const std::vector<unsigned char> & data) { ! boost::recursive_mutex::scoped_lock ! lock(this->stream_listener.node_mutex_); if (data.size() > this->buffer.size()) { --- 6814,6819 ---- do_read(const std::vector<unsigned char> & data) { ! openvrml::read_write_mutex::scoped_write_lock ! lock(this->stream_listener.image_mutex_); if (data.size() > this->buffer.size()) { *************** *** 6932,6938 **** bool image_stream_listener::jpeg_reader::output_scanlines() { - boost::recursive_mutex::scoped_lock - lock(this->stream_listener.node_mutex_); - JDIMENSION top = this->cinfo_.output_scanline; bool result = true; --- 6952,6955 ---- *************** *** 6976,6982 **** openvrml::image & image, openvrml::node & node, ! boost::recursive_mutex & node_mutex): uri_(uri), ! node_mutex_(node_mutex), image_(image), node_(node) --- 6993,6999 ---- openvrml::image & image, openvrml::node & node, ! openvrml::read_write_mutex & image_mutex): uri_(uri), ! image_mutex_(image_mutex), image_(image), node_(node) *************** *** 7011,7015 **** void update_texture(background_node & node, ! boost::recursive_mutex & node_mutex, const openvrml::mfstring & url, openvrml::image & img) --- 7028,7032 ---- void update_texture(background_node & node, ! openvrml::read_write_mutex & img_mutex, const openvrml::mfstring & url, openvrml::image & img) *************** *** 7031,7035 **** img, node, ! node_mutex)); node.scene()->read_stream(in, listener); } --- 7048,7052 ---- img, node, ! img_mutex)); node.scene()->read_stream(in, listener); } *************** *** 7045,7049 **** if (this->front_needs_update) { update_texture(*this, ! this->mutex(), this->front_url_, this->front); --- 7062,7066 ---- if (this->front_needs_update) { update_texture(*this, ! this->front_mutex_, this->front_url_, this->front); *************** *** 7052,7056 **** if (this->back_needs_update) { update_texture(*this, ! this->mutex(), this->back_url_, this->back); --- 7069,7073 ---- if (this->back_needs_update) { update_texture(*this, ! this->back_mutex_, this->back_url_, this->back); *************** *** 7059,7063 **** if (this->left_needs_update) { update_texture(*this, ! this->mutex(), this->left_url_, this->left); --- 7076,7080 ---- if (this->left_needs_update) { update_texture(*this, ! this->left_mutex_, this->left_url_, this->left); *************** *** 7066,7070 **** if (this->right_needs_update) { update_texture(*this, ! this->mutex(), this->right_url_, this->right); --- 7083,7087 ---- if (this->right_needs_update) { update_texture(*this, ! this->right_mutex_, this->right_url_, this->right); *************** *** 7073,7077 **** if (this->top_needs_update) { update_texture(*this, ! this->mutex(), this->top_url_, this->top); --- 7090,7094 ---- if (this->top_needs_update) { update_texture(*this, ! this->top_mutex_, this->top_url_, this->top); *************** *** 7080,7084 **** if (this->bottom_needs_update) { update_texture(*this, ! this->mutex(), this->bottom_url_, this->bottom); --- 7097,7101 ---- if (this->bottom_needs_update) { update_texture(*this, ! this->bottom_mutex_, this->bottom_url_, this->bottom); *************** *** 12481,12485 **** this->image_, *this, ! this->mutex())); this->scene()->read_stream(in, listener); } --- 12498,12502 ---- this->image_, *this, ! this->image_mutex_)); this->scene()->read_stream(in, listener); } *************** *** 13658,13668 **** * Render each of the children. * ! * @param viewer a Viewer. ! * @param context a rendering context. */ ! void ! inline_node:: ! do_render_child(openvrml::viewer & viewer, ! const rendering_context context) { this->load(); --- 13675,13683 ---- * Render each of the children. * ! * @param viewer a @c viewer. ! * @param context a @c rendering_context. */ ! void inline_node::do_render_child(openvrml::viewer & viewer, ! const rendering_context context) { this->load(); Index: browser.cpp =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/browser.cpp,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** browser.cpp 31 May 2007 07:18:55 -0000 1.216 --- browser.cpp 1 Jun 2007 05:34:02 -0000 1.217 *************** *** 4110,4115 **** OPENVRML_THROW1(std::bad_alloc) { - boost::recursive_mutex::scoped_lock lock(this->mutex()); - using boost::static_pointer_cast; --- 4110,4113 ---- Index: read_write_mutex.h =================================================================== RCS file: /cvsroot/openvrml/openvrml/src/libopenvrml/openvrml/read_write_mutex.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** read_write_mutex.h 18 May 2007 06:49:08 -0000 1.2 --- read_write_mutex.h 1 Jun 2007 05:34:02 -0000 1.3 *************** *** 36,40 **** --- 36,44 ---- public: + class scoped_read_write_lock; + class scoped_read_lock : boost::noncopyable { + friend class scoped_read_write_lock; + read_write_mutex & mutex_; boost::mutex::scoped_lock lock_; *************** *** 54,57 **** --- 58,70 ---- }; + class scoped_read_write_lock : scoped_read_lock { + public: + explicit scoped_read_write_lock(read_write_mutex & mutex); + ~scoped_read_write_lock(); + + void promote(); + void demote(); + }; + read_write_mutex(); }; |