gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/LoadThread.cpp libbase/...
Date: Mon, 07 May 2007 07:25:06 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/07 07:25:06

Modified files:
        .              : ChangeLog 
        libbase        : LoadThread.cpp LoadThread.h 

Log message:
                * libbase/LoadThread.{cpp,h}: Make thread usage a compilt-time
                  configuration. Temporarely defaults to NOT using thread till
                  we fix bug #19811 and general CPU hogs during loading.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3113&r2=1.3114
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/LoadThread.h?cvsroot=gnash&r1=1.6&r2=1.7

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3113
retrieving revision 1.3114
diff -u -b -r1.3113 -r1.3114
--- ChangeLog   6 May 2007 22:57:34 -0000       1.3113
+++ ChangeLog   7 May 2007 07:25:06 -0000       1.3114
@@ -1,3 +1,9 @@
+2007-05-07 Sandro Santilli <address@hidden>
+
+       * libbase/LoadThread.{cpp,h}: Make thread usage a compile-time
+         configuration. Temporarely defaults to NOT using thread till
+         we fix bug #19811 and general CPU hogs during loading.
+
 2007-05-07 Markus Gothe <address@hidden>
 
        * configure.ac, gui/aqua*: Added aqua/carbon-stubs.

Index: libbase/LoadThread.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libbase/LoadThread.cpp      6 May 2007 20:03:55 -0000       1.9
+++ libbase/LoadThread.cpp      7 May 2007 07:25:06 -0000       1.10
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-// $Id: LoadThread.cpp,v 1.9 2007/05/06 20:03:55 tgc Exp $
+// $Id: LoadThread.cpp,v 1.10 2007/05/07 07:25:06 strk Exp $
 
 #include "LoadThread.h"
 
@@ -48,7 +48,11 @@
        if (_stream.get() != NULL) {
                // Start the downloading.
                setupCache();
+#ifdef THREADED_LOADS
                _thread.reset( new 
boost::thread(boost::bind(LoadThread::downloadThread, this)) );
+#else
+               downloadThread(this);
+#endif
 
                return true;
        } else {
@@ -103,7 +107,9 @@
        // so we now either load more data into the cache, or completely
        // replace the content.
 
+#ifdef THREADED_LOADS
        boost::mutex::scoped_lock lock(_mutex);
+#endif
 
        // If the new data can fit in the cache we just load it into it
        if (_cacheStart <= _userPosition && static_cast<long>(bytes) + 
_userPosition < _cacheStart + _cacheSize) {
@@ -205,19 +211,23 @@
 
 bool LoadThread::completed()
 {
+#ifdef THREADED_LOADS
        boost::mutex::scoped_lock lock(_mutex);
        if (  _completed && _thread.get() )
        {
                _thread->join();
                _thread.reset(NULL);
        }
+#endif
 
        return _completed;
 }
 
 void LoadThread::setupCache()
 {
+#ifdef THREADED_LOADS
        boost::mutex::scoped_lock lock(_mutex);
+#endif
 
        _cache = new uint8_t[1024*500];
        _cacheSize = 1024*500;
@@ -246,7 +256,9 @@
                return;
        }
 
+#ifdef THREADED_LOADS
        boost::mutex::scoped_lock lock(_mutex);
+#endif
 
        if (_loadPosition != _actualPosition) 
_stream->set_position(_loadPosition);
 
@@ -288,7 +300,9 @@
                return;
        }
 
+#ifdef THREADED_LOADS
        boost::mutex::scoped_lock lock(_mutex);
+#endif
 
        long nextpos = _loadPosition + _chunkSize;
        if ( nextpos > _streamSize ) nextpos = _streamSize;

Index: libbase/LoadThread.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/LoadThread.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libbase/LoadThread.h        2 May 2007 12:11:31 -0000       1.6
+++ libbase/LoadThread.h        7 May 2007 07:25:06 -0000       1.7
@@ -19,14 +19,20 @@
 #ifndef __LOADTHREAD_H__
 #define __LOADTHREAD_H__
 
-// $Id: LoadThread.h,v 1.6 2007/05/02 12:11:31 strk Exp $
+
+#include "tu_file.h"
+
 #include <boost/thread/thread.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/bind.hpp>
 
-#include "tu_file.h"
 #include <memory>
 
+// Undefine this to NOT use a thread for loading
+// This is useful for debugging.
+//#define THREADED_LOADS 1
+
+
 /// \brief
 /// The LoadThread class can be used to download from a file
 /// or stream using a thread, without having to block.
@@ -112,9 +118,11 @@
 
        volatile bool _completed;
 
+#ifdef THREADED_LOADS
        boost::mutex _mutex;
 
        std::auto_ptr<boost::thread> _thread;
+#endif
        
        volatile long _loadPosition;
        volatile long _userPosition;




reply via email to

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