Commit missing modifications/change ConcurrentRun description a bit

This commit is contained in:
Arnaud Bienner 2012-04-25 00:29:19 +02:00
parent 76b98000fe
commit 01daea7090
4 changed files with 13 additions and 5 deletions

View File

@ -26,19 +26,21 @@
/* /*
The aim of ThreadFunctor classes and ConcurrentRun::Run() functions is to The aim of ThreadFunctor classes and ConcurrentRun::Run() functions is to
complete QtConcurrentRun, which lack support of using a particular complete QtConcurrentRun, which lack support for using a particular
QThreadPool, as it always uses QThreadPool::globalInstance(). QThreadPool, as it always uses QThreadPool::globalInstance().
This is problematic when we do not want to share the same thread pool over This is problematic when we do not want to share the same thread pool over
all the application, but want to keep the convenient QtConcurrent::run() all the application, but want to keep the convenient QtConcurrent::run()
functor syntax: time critical changes are performed in their own pool, which functor syntax.
is not empty by other actions, like when using QtConcurrentRun::run() With ConcurrentRun::Run(), time critical changes are performed in their own
pool, which is not empty by other actions (as it happens when using
QtConcurrentRun::run())
ThreadFunctor classes are used to store a functor and its arguments, and ThreadFunctor classes are used to store a functor and its arguments, and
Run() functions are used for convenience: to directly create a new Run() functions are used for convenience: to directly create a new
ThreadFunctor object and start it. ThreadFunctor object and start it.
Currently, only functions with two arguments and a return value are Currently, only functions with one or two arguments and a return value are
supported, but other might be added easily for X arguments by defining a new supported, but other might be added easily for X arguments by defining a new
ThreadFunctorBasX class, and add new Run() function. ThreadFunctorBasX class, and add new Run() function.
*/ */

View File

@ -22,6 +22,7 @@
#include "gstelementdeleter.h" #include "gstelementdeleter.h"
#include "gstengine.h" #include "gstengine.h"
#include "gstenginepipeline.h" #include "gstenginepipeline.h"
#include "core/concurrentrun.h"
#include "core/logging.h" #include "core/logging.h"
#include "core/utilities.h" #include "core/utilities.h"
#include "internet/internetmodel.h" #include "internet/internetmodel.h"
@ -781,7 +782,8 @@ GstState GstEnginePipeline::state() const {
} }
QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(GstState state) { QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(GstState state) {
return QtConcurrent::run(&gst_element_set_state, pipeline_, state); return ConcurrentRun::Run<GstStateChangeReturn, GstElement*, GstState>(
&set_state_threadpool_, &gst_element_set_state, pipeline_, state);
} }
bool GstEnginePipeline::Seek(qint64 nanosec) { bool GstEnginePipeline::Seek(qint64 nanosec) {

View File

@ -22,6 +22,7 @@
#include <QFuture> #include <QFuture>
#include <QMutex> #include <QMutex>
#include <QObject> #include <QObject>
#include <QThreadPool>
#include <QTimeLine> #include <QTimeLine>
#include <QUrl> #include <QUrl>
@ -259,6 +260,8 @@ class GstEnginePipeline : public QObject {
GstElement* audiosink_; GstElement* audiosink_;
uint bus_cb_id_; uint bus_cb_id_;
QThreadPool set_state_threadpool_;
}; };
#endif // GSTENGINEPIPELINE_H #endif // GSTENGINEPIPELINE_H

View File

@ -140,6 +140,7 @@ add_test_file(translations_test.cpp false)
add_test_file(utilities_test.cpp false) add_test_file(utilities_test.cpp false)
#add_test_file(xspfparser_test.cpp false) #add_test_file(xspfparser_test.cpp false)
add_test_file(closure_test.cpp false) add_test_file(closure_test.cpp false)
add_test_file(concurrentrun_test.cpp false)
#if(LINUX AND HAVE_DBUS) #if(LINUX AND HAVE_DBUS)
# add_test_file(mpris1_test.cpp true) # add_test_file(mpris1_test.cpp true)