cByteBuffer: Improved SingleThreadAccessChecker performance.
But it's still poor and unusable for regular testing.
This commit is contained in:
parent
7a400bdcd1
commit
35a3a1b9f4
|
@ -131,7 +131,7 @@ public:
|
||||||
{
|
{
|
||||||
ASSERT(
|
ASSERT(
|
||||||
(*a_ThreadID == std::this_thread::get_id()) || // Either the object is used by current thread...
|
(*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:
|
// Mark as being used by this thread:
|
||||||
|
@ -147,8 +147,13 @@ public:
|
||||||
protected:
|
protected:
|
||||||
/** Points to the storage used for ID of the thread using the object. */
|
/** Points to the storage used for ID of the thread using the object. */
|
||||||
std::thread::id * m_ThreadID;
|
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);
|
#define CHECK_THREAD cSingleThreadAccessChecker Checker(&m_ThreadID);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user