Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit c488b267 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Introducing C++11 support switch for <thread> and <condition_variable>.

If you need one of these two C++11 headers, include <ext/threading.h> instead, which will use C++11 headers if present or TBB's compatibility layer otherwise.

closes #567
parent b4547688
......@@ -33,7 +33,6 @@
#include "tgt/texturereadertga.h"
#include "tgt/qt/qtapplication.h"
#include "tgt/qt/qtthreadedcanvas.h"
#include "tbb/compat/thread"
#include "application/campvispainter.h"
#include "application/gui/mainwindow.h"
......@@ -44,6 +43,7 @@
#include "core/tools/quadrenderer.h"
#include "core/pipeline/abstractpipeline.h"
#include "core/pipeline/visualizationprocessor.h"
#include "modules/pipelinefactory.h"
#ifdef CAMPVIS_HAS_SCRIPTING
......
......@@ -26,8 +26,9 @@
#define CAMPVISPAINTER_H__
#include "sigslot/sigslot.h"
#include "tbb/atomic.h"
#include "tbb/compat/condition_variable"
#include <ext/threading.h>
#include <tbb/atomic.h>
#include "tgt/logmanager.h"
#include "tgt/painter.h"
......
......@@ -156,8 +156,6 @@ ENDIF(WIN32)
IF(CMAKE_COMPILER_IS_GNUCXX)
# enable C++11 support in GCC
LIST(APPEND CMAKE_CXX_FLAGS "-std=c++11")
# however: we want to use the TBB implementation of threads
LIST(APPEND CampvisGlobalDefinitions "-DTBB_IMPLEMENT_CPP0X")
ENDIF()
# tgt configuration
......
......@@ -22,9 +22,10 @@
//
// ================================================================================================
#include <tbb/compat/thread>
#include "tgt/assert.h"
#include <ext/threading.h>
#include "abstractprocessor.h"
#include "core/properties/abstractproperty.h"
#include "core/tools/job.h"
......
......@@ -81,7 +81,7 @@ namespace campvis {
void OpenGLJobProcessor::run() {
_this_thread_id = std::this_thread::get_id();
std::unique_lock<tbb::mutex> lock(tgt::GlContextManager::getRef().getGlMutex());
std::unique_lock<std::mutex> lock(tgt::GlContextManager::getRef().getGlMutex());
clock_t lastCleanupTime = clock() * 1000 / CLOCKS_PER_SEC;
while (! _stopExecution) {
......
......@@ -27,14 +27,15 @@
#include "sigslot/sigslot.h"
#include "tgt/glcontextmanager.h"
#include "tgt/singleton.h"
#include <ext/threading.h>
#include <tbb/atomic.h>
#include <tbb/concurrent_queue.h>
#include <tbb/concurrent_hash_map.h>
#include <tbb/concurrent_vector.h>
#include <tbb/compat/condition_variable>
#include "tgt/glcontextmanager.h"
#include "tgt/singleton.h"
#include "core/coreapi.h"
#include "core/tools/job.h"
......
......@@ -26,7 +26,8 @@
#define RUNNABLE_H__
#include "tgt/logmanager.h"
#include <tbb/compat/thread>
#include <ext/threading.h>
#include <tbb/atomic.h>
#include "core/coreapi.h"
......
......@@ -25,7 +25,7 @@ namespace tgt {
_glMutex.unlock();
}
tbb::mutex& GlContextManager::getGlMutex() {
std::mutex& GlContextManager::getGlMutex() {
return _glMutex;
}
......@@ -58,7 +58,7 @@ namespace tgt {
tgtAssert(_contexts.find(context) == _contexts.end(), "Tried to double register the same context.");
{
tbb::mutex::scoped_lock localLock(_localMutex);
std::lock_guard<std::mutex> localLock(_localMutex);
_contexts.insert(context);
}
......@@ -78,7 +78,7 @@ namespace tgt {
void GlContextManager::removeContext(GLCanvas* context) {
_currentContext = 0;
tbb::mutex::scoped_lock lock(_localMutex);
std::lock_guard<std::mutex> lock(_localMutex);
std::set<GLCanvas*>::iterator it = _contexts.find(context);
if (it != _contexts.end()) {
_contexts.erase(it);
......
......@@ -4,7 +4,8 @@
#include "tgt/singleton.h"
#include "tgt/glcanvas.h"
#include "tgt/types.h"
#include <tbb/mutex.h> // TODO: TBB dependency in TGT is not that beautiful...
#include <ext/threading.h>
#include <set>
#include <string>
......@@ -49,7 +50,7 @@ namespace tgt {
* Returns the mutex protecting the OpenGL context
* \return _glMutex
*/
tbb::mutex& getGlMutex();
std::mutex& getGlMutex();
/**
* Acquires \a context as current OpenGL context.
......@@ -97,9 +98,9 @@ namespace tgt {
std::set<GLCanvas*> _contexts; ///< Map of all OpenGL contexts
GLCanvas* _currentContext; ///< Current active OpenGL context
tbb::mutex _glMutex; ///< Mutex protecting OpenGL for multi-threaded access
std::mutex _glMutex; ///< Mutex protecting OpenGL for multi-threaded access
tbb::mutex _localMutex; ///< local mutex to prodect _contexts
std::mutex _localMutex; ///< local mutex to prodect _contexts
};
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
//
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions
// and limitations under the License.
//
// ================================================================================================
#ifndef THREADING_H__
#define THREADING_H__
// This header provides cross-compiler includes for <thread> and <condition_variable>.
// These two includes are defined by C++11 and supported by GCC and MSVC11+. All other
// implementations must use TBBs compat layer implementation.
#if (_MSC_VER == 1600) //check for MSVC2010
#ifndef TBB_IMPLEMENT_CPP0X
#define TBB_IMPLEMENT_CPP0X 1
#endif
#include <tbb/compat/condition_variable>
#include <tbb/compat/thread>
#include <tbb/mutex.h>
namespace std {
// it gets even uglier:
// A C++11 std::condition_variable requires a std::mutex, which however is not provided
// by TBB's compat layer. Hence, we use a tbb::mutex and redeclare it as std::mutex.
using tbb::mutex;
}
#else
#include <condition_variable>
#include <mutex>
#include <thread>
#endif
#endif // THREADING_H__
......@@ -37,7 +37,7 @@
#include <tgt/matrix.h>
#include <tbb/compat/thread>
#include <ext/threading.h>
#include <tbb/atomic.h>
#include <tbb/mutex.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment