Always activate thread safety if possible

pull/261/head
Léo Terziman 2014-01-16 10:57:51 +01:00
parent 9cc1e8fa1c
commit 34c3449cdd
2 changed files with 9 additions and 13 deletions

View File

@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "Importer.h"
// ------------------------------------------------------------------------------------------------
#ifdef AI_C_THREADSAFE
#ifndef ASSIMP_BUILD_SINGLETHREADED
# include <boost/thread/thread.hpp>
# include <boost/thread/mutex.hpp>
#endif
@ -87,7 +87,7 @@ namespace Assimp
}
#ifdef AI_C_THREADSAFE
#ifndef ASSIMP_BUILD_SINGLETHREADED
/** Global mutex to manage the access to the logstream map */
static boost::mutex gLogStreamMutex;
#endif
@ -104,7 +104,7 @@ public:
}
~LogToCallbackRedirector() {
#ifdef AI_C_THREADSAFE
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
#endif
// (HACK) Check whether the 'stream.user' pointer points to a
@ -337,7 +337,7 @@ ASSIMP_API void aiAttachLogStream( const aiLogStream* stream )
{
ASSIMP_BEGIN_EXCEPTION_REGION();
#ifdef AI_C_THREADSAFE
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
#endif
@ -356,7 +356,7 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
{
ASSIMP_BEGIN_EXCEPTION_REGION();
#ifdef AI_C_THREADSAFE
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
#endif
// find the logstream associated with this data
@ -381,7 +381,7 @@ ASSIMP_API aiReturn aiDetachLogStream( const aiLogStream* stream)
ASSIMP_API void aiDetachAllLogStreams(void)
{
ASSIMP_BEGIN_EXCEPTION_REGION();
#ifdef AI_C_THREADSAFE
#ifndef ASSIMP_BUILD_SINGLETHREADED
boost::mutex::scoped_lock lock(gLogStreamMutex);
#endif
for (LogStreamMap::iterator it = gActiveLogStreams.begin(); it != gActiveLogStreams.end(); ++it) {

View File

@ -234,13 +234,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* threads then and is itself not threadsafe.
* If this flag is specified boost::threads is *not* required. */
//////////////////////////////////////////////////////////////////////////
#ifndef ASSIMP_BUILD_SINGLETHREADED
# define ASSIMP_BUILD_SINGLETHREADED
#endif
#ifndef ASSIMP_BUILD_SINGLETHREADED
# define AI_C_THREADSAFE
#endif // !! ASSIMP_BUILD_SINGLETHREADED
//#ifndef ASSIMP_BUILD_SINGLETHREADED
//# define ASSIMP_BUILD_SINGLETHREADED
//#endif
#if defined(_DEBUG) || ! defined(NDEBUG)
# define ASSIMP_BUILD_DEBUG