1
0
Fork 0

cByteBuffer: Improved SingleThreadAccessChecker performance.

But it's still poor and unusable for regular testing.
This commit is contained in:
Mattes D 2015-01-03 22:20:30 +01:00
parent 7a400bdcd1
commit 35a3a1b9f4
1 changed files with 6 additions and 1 deletions

View File

@ -131,7 +131,7 @@ public:
{
ASSERT(
(*a_ThreadID == std::this_thread::get_id()) || // Either the object is used by current thread...
(*a_ThreadID == std::thread::id()) // ... or by no thread at all
(*a_ThreadID == m_EmptyThreadID) // ... or by no thread at all
);
// Mark as being used by this thread:
@ -147,8 +147,13 @@ public:
protected:
/** Points to the storage used for ID of the thread using the object. */
std::thread::id * m_ThreadID;
/** The value of an unassigned thread ID, used to speed up checking. */
static std::thread::id m_EmptyThreadID;
};
std::thread::id cSingleThreadAccessChecker::m_EmptyThreadID;
#define CHECK_THREAD cSingleThreadAccessChecker Checker(&m_ThreadID);
#else