mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-04 03:38:01 +08:00
0023988: Force use of reentrant mode
Reentrant mode switch is eliminated
This commit is contained in:
@@ -183,9 +183,7 @@ void NCollection_BaseAllocator::StandardCallBack
|
||||
const Standard_Size /*theSize*/)
|
||||
{
|
||||
static Standard_Mutex aMutex;
|
||||
Standard_Boolean isReentrant = Standard::IsReentrant();
|
||||
if (isReentrant)
|
||||
aMutex.Lock();
|
||||
aMutex.Lock();
|
||||
// statistics by storage size
|
||||
NCollection_DataMap<Standard_Size, StorageInfo>& aStMap = StorageMap();
|
||||
if (!aStMap.IsBound(theRoundSize))
|
||||
@@ -230,8 +228,7 @@ void NCollection_BaseAllocator::StandardCallBack
|
||||
}
|
||||
}
|
||||
|
||||
if (isReentrant)
|
||||
aMutex.Unlock();
|
||||
aMutex.Unlock();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
@@ -98,13 +98,10 @@ static Standard_Size CATCH_ID = 0;
|
||||
static void Debug_Create(Standard_Address theAlloc)
|
||||
{
|
||||
static Standard_Mutex aMutex;
|
||||
Standard_Boolean isReentrant = Standard::IsReentrant();
|
||||
if (isReentrant)
|
||||
aMutex.Lock();
|
||||
aMutex.Lock();
|
||||
StorageIDMap().Bind(theAlloc, ++CurrentID);
|
||||
StorageIDSet().Add(CurrentID);
|
||||
if (isReentrant)
|
||||
aMutex.Unlock();
|
||||
aMutex.Unlock();
|
||||
if (CurrentID == CATCH_ID)
|
||||
{
|
||||
// Place for break point for creation of investigated allocator
|
||||
@@ -120,17 +117,14 @@ static void Debug_Create(Standard_Address theAlloc)
|
||||
static void Debug_Destroy(Standard_Address theAlloc)
|
||||
{
|
||||
static Standard_Mutex aMutex;
|
||||
Standard_Boolean isReentrant = Standard::IsReentrant();
|
||||
if (isReentrant)
|
||||
aMutex.Lock();
|
||||
aMutex.Lock();
|
||||
if (StorageIDMap().IsBound(theAlloc))
|
||||
{
|
||||
Standard_Size anID = StorageIDMap()(theAlloc);
|
||||
StorageIDSet().Remove(anID);
|
||||
StorageIDMap().UnBind(theAlloc);
|
||||
}
|
||||
if (isReentrant)
|
||||
aMutex.Unlock();
|
||||
aMutex.Unlock();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
||||
Reference in New Issue
Block a user