[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog libbase/ref_counted.h server/pa...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog libbase/ref_counted.h server/pa... |
Date: |
Sun, 01 Jul 2007 17:34:59 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/07/01 17:34:59
Modified files:
. : ChangeLog
libbase : ref_counted.h
server/parser : movie_def_impl.cpp movie_def_impl.h
Log message:
* libbase/ref_counted.h: use 'long' for the ref count,
cleanup header inclusion, prepare for using an atomic
counter for thread safety (not enabled yet).
* server/parser/movie_def_impl.{cpp,h}: have MovieLoader
keep the boost::thread by auto_ptr for proper destruction.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3629&r2=1.3630
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/ref_counted.h?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.75&r2=1.76
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&r1=1.49&r2=1.50
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3629
retrieving revision 1.3630
diff -u -b -r1.3629 -r1.3630
--- ChangeLog 1 Jul 2007 16:51:19 -0000 1.3629
+++ ChangeLog 1 Jul 2007 17:34:58 -0000 1.3630
@@ -1,3 +1,11 @@
+2007-07-01 Sandro Santilli <address@hidden>
+
+ * libbase/ref_counted.h: use 'long' for the ref count,
+ cleanup header inclusion, prepare for using an atomic
+ counter for thread safety (not enabled yet).
+ * server/parser/movie_def_impl.{cpp,h}: have MovieLoader
+ keep the boost::thread by auto_ptr for proper destruction.
+
2007-07-01 Markus Gothe <address@hidden>
* README: Added note on IRC.
Index: libbase/ref_counted.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/ref_counted.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- libbase/ref_counted.h 1 Jul 2007 10:54:10 -0000 1.10
+++ libbase/ref_counted.h 1 Jul 2007 17:34:59 -0000 1.11
@@ -15,7 +15,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: ref_counted.h,v 1.10 2007/07/01 10:54:10 bjacques Exp $ */
+/* $Id: ref_counted.h,v 1.11 2007/07/01 17:34:59 strk Exp $ */
#ifndef GNASH_REF_COUNTED_H
#define GNASH_REF_COUNTED_H
@@ -24,7 +24,10 @@
#include "config.h"
#endif
-#include "container.h"
+#include "tu_config.h" // for DSOEXPORT (better move that define in some other
file?)
+
+#include <cassert>
+#include <boost/detail/atomic_count.hpp>
namespace gnash {
@@ -38,7 +41,12 @@
private:
- mutable int m_ref_count;
+ typedef long Counter;
+ // boost atomic_counter is thread-safe, but doesn't
+ // provide a copy constructor.
+ //typedef mutable boost::detail::atomic_count Counter;
+
+ mutable Counter m_ref_count;
protected:
@@ -59,21 +67,20 @@
void add_ref() const
{
assert(m_ref_count >= 0);
- m_ref_count++;
+ ++m_ref_count;
}
void drop_ref() const
{
assert(m_ref_count > 0);
- m_ref_count--;
- if (m_ref_count <= 0)
+ if (!--m_ref_count)
{
// Delete me!
delete this;
}
}
- int get_ref_count() const { return m_ref_count; }
+ long get_ref_count() const { return m_ref_count; }
// These two methods are defined as a temporary hack to
// easy transition to the GC model. Was added when introducing
Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -b -r1.75 -r1.76
--- server/parser/movie_def_impl.cpp 1 Jul 2007 10:54:34 -0000 1.75
+++ server/parser/movie_def_impl.cpp 1 Jul 2007 17:34:59 -0000 1.76
@@ -81,9 +81,15 @@
MovieLoader::~MovieLoader()
{
+ cout << "MovieLoader dtor called" << endl;
+
// we should assert _movie_def._loadingCanceled
// but we're not friend yet (anyone introduce us ?)
- if ( _thread ) _thread->join();
+ if ( _thread.get() )
+ {
+ cout << "Joining thread.." << endl;
+ _thread->join();
+ }
}
bool
@@ -91,7 +97,7 @@
{
boost::mutex::scoped_lock lock(_mutex);
- return _thread != NULL;
+ return _thread.get() != NULL;
}
bool
@@ -99,7 +105,7 @@
{
boost::mutex::scoped_lock lock(_mutex);
- if (!_thread) {
+ if (!_thread.get()) {
return false;
}
boost::thread this_thread;
@@ -125,7 +131,7 @@
// Those tests do seem a bit redundant, though...
boost::mutex::scoped_lock lock(_mutex);
- _thread = new boost::thread(boost::bind(execute, &_movie_def));
+ _thread.reset( new boost::thread(boost::bind(execute, &_movie_def)) );
return true;
}
@@ -215,6 +221,8 @@
movie_def_impl::~movie_def_impl()
{
+ cout << "movie_def_impl dtor called" << endl;
+
// Request cancelation of the loading thread
_loadingCanceled = true;
Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- server/parser/movie_def_impl.h 1 Jul 2007 10:54:34 -0000 1.49
+++ server/parser/movie_def_impl.h 1 Jul 2007 17:34:59 -0000 1.50
@@ -115,7 +115,7 @@
movie_def_impl& _movie_def;
mutable boost::mutex _mutex;
- boost::thread* _thread;
+ std::auto_ptr<boost::thread> _thread;
/// Entry point for the actual thread
static void execute(movie_def_impl* md);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog libbase/ref_counted.h server/pa...,
Sandro Santilli <=