0023988: Force use of reentrant mode

Reentrant mode switch is eliminated
This commit is contained in:
szv
2013-05-24 09:26:45 +04:00
parent 310659466b
commit bd0c22ce9f
13 changed files with 30 additions and 135 deletions
@@ -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();
}
//=======================================================================
+4 -10
View File
@@ -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();
}
//=======================================================================