From e09348c05d188979c490a9a22d39a1203cacc797 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 24 Dec 2014 09:13:58 +0100 Subject: [PATCH] ByteBuffer: SingleThreadAccessChecker is request-only. It slows the server down way too much, so it can't be turned on by default. --- src/ByteBuffer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ByteBuffer.cpp b/src/ByteBuffer.cpp index 080176dcd..b441d61ca 100644 --- a/src/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp @@ -13,6 +13,15 @@ +/** When defined, each access to a cByteBuffer object is checked whether it's done in the same thread. +cByteBuffer assumes that it is not used by multiple threads at once, this macro adds a runtime check for that. +Unfortunately it is very slow, so it is disabled even for regular DEBUG builds. */ +// #define DEBUG_SINGLE_THREAD_ACCESS + + + + + // Try to determine endianness: #if ( \ defined(__i386__) || defined(__alpha__) || \ @@ -109,7 +118,7 @@ public: -#ifdef _DEBUG +#ifdef DEBUG_SINGLE_THREAD_ACCESS /** Simple RAII class that is used for checking that no two threads are using an object simultanously. It requires the monitored object to provide the storage for a thread ID.