gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cp...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/parser/movie_def_impl.cp...
Date: Thu, 17 Apr 2008 10:58:01 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/17 10:58:01

Modified files:
        .              : ChangeLog 
        server/parser  : movie_def_impl.cpp movie_def_impl.h 

Log message:
                  Add a boost::barrier based mechanism to make
                  sure the loader thread execution waits for
                  the _thread member to be assigned-to.
                  Hopefully fixes bug #22915 and represents
                  a model for other thread starterts to follow
                  to avoid time-sensible joins aka segfaults
                  on exit.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6315&r2=1.6316
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.103&r2=1.104
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&r1=1.70&r2=1.71

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6315
retrieving revision 1.6316
diff -u -b -r1.6315 -r1.6316
--- ChangeLog   17 Apr 2008 10:22:21 -0000      1.6315
+++ ChangeLog   17 Apr 2008 10:58:00 -0000      1.6316
@@ -1,3 +1,14 @@
+2008-04-17 Sandro Santilli <address@hidden>
+
+       * server/parser/movie_def_impl.{cpp,h}:
+         Add a boost::barrier based mechanism to make
+         sure the loader thread execution waits for 
+         the _thread member to be assigned-to.
+         Hopefully fixes bug #22915 and represents
+         a model for other thread starterts to follow
+         to avoid time-sensible joins aka segfaults
+         on exit.
+
 2008-04-17 Benjamin Wolsey <address@hidden>
 
        * server/asobj/Color.{h,cpp}: register ASnative separately.

Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -b -r1.103 -r1.104
--- server/parser/movie_def_impl.cpp    10 Apr 2008 03:52:07 -0000      1.103
+++ server/parser/movie_def_impl.cpp    17 Apr 2008 10:58:01 -0000      1.104
@@ -75,8 +75,9 @@
 
 MovieLoader::MovieLoader(movie_def_impl& md)
        :
-       _movie_def(md)
-       ,_thread(NULL)
+       _movie_def(md),
+       _thread(NULL),
+       _barrier(2) // us and the main thread..
 {
 }
 
@@ -113,9 +114,11 @@
        return this_thread == *_thread;
 }
 
+// static..
 void
-MovieLoader::execute(movie_def_impl* md)
+MovieLoader::execute(MovieLoader& ml, movie_def_impl* md)
 {
+       ml._barrier.wait(); // let _thread assignment happen before going on
        md->read_all_swf();
 }
 
@@ -132,7 +135,9 @@
        // Those tests do seem a bit redundant, though...
        boost::mutex::scoped_lock lock(_mutex);
 
-       _thread.reset( new boost::thread(boost::bind(execute, &_movie_def)) );
+       _thread.reset( new boost::thread(boost::bind(execute, 
boost::ref(*this), &_movie_def)) );
+
+       _barrier.wait(); // let execution start befor returning
 
        return true;
 }

Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- server/parser/movie_def_impl.h      10 Apr 2008 03:52:07 -0000      1.70
+++ server/parser/movie_def_impl.h      17 Apr 2008 10:58:01 -0000      1.71
@@ -35,6 +35,7 @@
 #include <memory> // for auto_ptr
 #include <boost/thread/thread.hpp>
 #include <boost/thread/condition.hpp>
+#include <boost/thread/barrier.hpp>
 
 //
 // Forward declarations
@@ -113,8 +114,13 @@
        mutable boost::mutex _mutex;
        std::auto_ptr<boost::thread> _thread;
 
+       // Barrier to ensure that _thread
+       // is initialized before the loader thread
+       // continues execution
+       boost::barrier _barrier;
+
        /// Entry point for the actual thread
-       static void execute(movie_def_impl* md);
+       static void execute(MovieLoader& ml, movie_def_impl* md);
 };
 
 /// The Characters dictionary associated with each SWF file.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]