Move GlobeBrowsing thread pool to OpenSpace core

This commit is contained in:
Emil Axelsson
2017-07-21 11:25:30 +02:00
parent c3929f5d6d
commit 92c85bbd34
10 changed files with 23 additions and 33 deletions
@@ -22,16 +22,15 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___CONCURRENT_JOB_MANAGER___H__
#define __OPENSPACE_MODULE_GLOBEBROWSING___CONCURRENT_JOB_MANAGER___H__
#ifndef __OPENSPACE_CORE___CONCURRENT_JOB_MANAGER___H__
#define __OPENSPACE_CORE___CONCURRENT_JOB_MANAGER___H__
#include <modules/globebrowsing/other/concurrentqueue.h>
#include <modules/globebrowsing/other/threadpool.h>
#include <openspace/util/concurrentqueue.h>
#include <openspace/util/threadpool.h>
#include <mutex>
namespace openspace {
namespace globebrowsing {
// Templated abstract base class representing a job to be done.
// Client code derive from this class and implement the virtual execute() method
@@ -67,9 +66,8 @@ private:
ThreadPool threadPool;
};
} // namespace globebrowsing
} // namespace openspace
#include "concurrentjobmanager.inl"
#endif // __OPENSPACE_MODULE_GLOBEBROWSING___CONCURRENT_JOB_MANAGER___H__
#endif // __OPENSPACE_CORE___CONCURRENT_JOB_MANAGER___H__
@@ -25,7 +25,6 @@
#include <ghoul/misc/assert.h>
namespace openspace {
namespace globebrowsing {
template<typename P>
Job<P>::Job() {}
@@ -64,5 +63,4 @@ size_t ConcurrentJobManager<P>::numFinishedJobs() const {
return _finishedJobs.size();
}
} // namespace globebrowsing
} // namespace openspace
@@ -22,15 +22,14 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___CONCURRENT_QUEUE___H__
#define __OPENSPACE_MODULE_GLOBEBROWSING___CONCURRENT_QUEUE___H__
#ifndef __OPENSPACE_CORE___CONCURRENT_QUEUE___H__
#define __OPENSPACE_CORE___CONCURRENT_QUEUE___H__
#include <condition_variable>
#include <mutex>
#include <queue>
namespace openspace {
namespace globebrowsing {
/**
* Templated thread-safe queue based on std::thread and std::queue
@@ -54,9 +53,8 @@ private:
mutable std::condition_variable _cond;
};
} // namespace globebrowsing
} // namespace openspace
#include "concurrentqueue.inl"
#endif // __OPENSPACE_MODULE_GLOBEBROWSING___CONCURRENT_QUEUE___H__
#endif // __OPENSPACE_CORE___CONCURRENT_QUEUE___H__
@@ -23,7 +23,6 @@
****************************************************************************************/
namespace openspace {
namespace globebrowsing {
template <typename T>
T ConcurrentQueue<T>::pop() {
@@ -71,5 +70,4 @@ size_t ConcurrentQueue<T>::size() const {
return s;
}
} // namespace globebrowsing
} // namespace openspace
@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___THREAD_POOL___H__
#define __OPENSPACE_MODULE_GLOBEBROWSING___THREAD_POOL___H__
#ifndef __OPENSPACE_CORE___THREAD_POOL___H__
#define __OPENSPACE_CORE___THREAD_POOL___H__
#include <condition_variable>
#include <functional>
@@ -36,7 +36,6 @@
// Implementatin based on http://progsch.net/wordpress/?p=81
namespace openspace {
namespace globebrowsing {
class ThreadPool;
@@ -70,7 +69,6 @@ private:
bool stop;
};
} // namespace globebrowsing
} // namespace openspace
#endif // __OPENSPACE_MODULE_GLOBEBROWSING___THREAD_POOL___H__
#endif // __OPENSPACE_CORE___THREAD_POOL___H__
-6
View File
@@ -59,19 +59,14 @@ set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/meshes/skirtedgrid.h
${CMAKE_CURRENT_SOURCE_DIR}/meshes/trianglesoup.h
${CMAKE_CURRENT_SOURCE_DIR}/other/concurrentjobmanager.h
${CMAKE_CURRENT_SOURCE_DIR}/other/concurrentjobmanager.inl
${CMAKE_CURRENT_SOURCE_DIR}/other/prioritizingconcurrentjobmanager.h
${CMAKE_CURRENT_SOURCE_DIR}/other/prioritizingconcurrentjobmanager.inl
${CMAKE_CURRENT_SOURCE_DIR}/other/concurrentqueue.h
${CMAKE_CURRENT_SOURCE_DIR}/other/concurrentqueue.inl
${CMAKE_CURRENT_SOURCE_DIR}/other/distanceswitch.h
${CMAKE_CURRENT_SOURCE_DIR}/other/pixelbuffer.h
${CMAKE_CURRENT_SOURCE_DIR}/other/pixelbuffercontainer.h
${CMAKE_CURRENT_SOURCE_DIR}/other/pixelbuffercontainer.inl
${CMAKE_CURRENT_SOURCE_DIR}/other/statscollector.h
${CMAKE_CURRENT_SOURCE_DIR}/other/statscollector.inl
${CMAKE_CURRENT_SOURCE_DIR}/other/threadpool.h
${CMAKE_CURRENT_SOURCE_DIR}/other/lruthreadpool.h
${CMAKE_CURRENT_SOURCE_DIR}/other/lruthreadpool.inl
@@ -157,7 +152,6 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/other/distanceswitch.cpp
${CMAKE_CURRENT_SOURCE_DIR}/other/pixelbuffer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/other/statscollector.cpp
${CMAKE_CURRENT_SOURCE_DIR}/other/threadpool.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/chunkrenderer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/layershadermanager.cpp
@@ -25,9 +25,10 @@
#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___PRIORITIZING_CONCURRENT_JOB_MANAGER___H__
#define __OPENSPACE_MODULE_GLOBEBROWSING___PRIORITIZING_CONCURRENT_JOB_MANAGER___H__
#include <modules/globebrowsing/other/concurrentqueue.h>
#include <modules/globebrowsing/other/lruthreadpool.h>
#include <modules/globebrowsing/other/concurrentjobmanager.h>
#include <openspace/util/concurrentjobmanager.h>
#include <openspace/util/concurrentqueue.h>
#include <mutex>
+2 -1
View File
@@ -25,9 +25,10 @@
#ifndef __OPENSPACE_MODULE_GLOBEBROWSING___TILELOADJOB___H__
#define __OPENSPACE_MODULE_GLOBEBROWSING___TILELOADJOB___H__
#include <modules/globebrowsing/other/concurrentjobmanager.h>
#include <modules/globebrowsing/tile/tile.h>
#include <openspace/util/concurrentjobmanager.h>
namespace openspace {
namespace globebrowsing {
+6
View File
@@ -154,6 +154,7 @@ set(OPENSPACE_SOURCE
${OPENSPACE_BASE_DIR}/src/util/histogram.cpp
${OPENSPACE_BASE_DIR}/src/util/task.cpp
${OPENSPACE_BASE_DIR}/src/util/taskloader.cpp
${OPENSPACE_BASE_DIR}/src/util/threadpool.cpp
${OPENSPACE_BASE_DIR}/src/util/time.cpp
${OPENSPACE_BASE_DIR}/src/util/timeline.cpp
${OPENSPACE_BASE_DIR}/src/util/timemanager.cpp
@@ -283,6 +284,10 @@ set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/util/blockplaneintersectiongeometry.h
${OPENSPACE_BASE_DIR}/include/openspace/util/boxgeometry.h
${OPENSPACE_BASE_DIR}/include/openspace/util/camera.h
${OPENSPACE_BASE_DIR}/include/openspace/util/concurrentjobmanager.h
${OPENSPACE_BASE_DIR}/include/openspace/util/concurrentjobmanager.inl
${OPENSPACE_BASE_DIR}/include/openspace/util/concurrentqueue.h
${OPENSPACE_BASE_DIR}/include/openspace/util/concurrentqueue.inl
${OPENSPACE_BASE_DIR}/include/openspace/util/factorymanager.h
${OPENSPACE_BASE_DIR}/include/openspace/util/factorymanager.inl
${OPENSPACE_BASE_DIR}/include/openspace/util/keys.h
@@ -305,6 +310,7 @@ set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/util/timerange.h
${OPENSPACE_BASE_DIR}/include/openspace/util/updatestructures.h
${OPENSPACE_BASE_DIR}/include/openspace/util/transformationmanager.h
${OPENSPACE_BASE_DIR}/include/openspace/util/threadpool.h
${OPENSPACE_BASE_DIR}/include/openspace/util/histogram.h
${OPENSPACE_BASE_DIR}/include/openspace/util/gpudata.h
)
@@ -22,10 +22,9 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/globebrowsing/other/threadpool.h>
#include <openspace/util/threadpool.h>
namespace openspace {
namespace globebrowsing {
Worker::Worker(ThreadPool& pool)
: pool(pool)
@@ -106,5 +105,4 @@ void ThreadPool::clearTasks() {
} // release lock
}
} // namespace globebrowsing
} // namespace openspace