1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030329: Move BRepMesh_IncAllocator to NCollection package

NCollection_IncAllocator has been extended with optional mutex allocation (disabled by default).
This commit is contained in:
kgv
2019-02-04 12:21:14 +03:00
committed by bugmaster
parent 976627e601
commit 95c882e9d4
6 changed files with 45 additions and 59 deletions

View File

@@ -18,7 +18,6 @@
#include <IMeshData_Edge.hxx>
#include <OSD_Parallel.hxx>
#include <BRepMesh_GeomTool.hxx>
#include <BRepMesh_IncAllocator.hxx>
namespace
{

View File

@@ -1,50 +0,0 @@
// Created on: 2016-06-20
// Created by: Oleg AGASHIN
// Copyright (c) 2016 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _BRepMesh_IncAllocator_HeaderFile
#define _BRepMesh_IncAllocator_HeaderFile
#include <NCollection_IncAllocator.hxx>
#include <Standard_Mutex.hxx>
//! Extension for NCollection_IncAllocator implementing simple thread safety
//! by introduction of Mutex. Intended for use in couple with BRepMeshData
//! entities in order to prevent data races while building data model in
//! parallel mode. Note that this allocator is supposed for use by collections
//! which allocate memory by huge blocks at arbitrary moment, thus it should
//! not introduce significant performance slow down.
class BRepMesh_IncAllocator : public NCollection_IncAllocator
{
public:
//! Constructor
BRepMesh_IncAllocator(const size_t theBlockSize = DefaultBlockSize)
: NCollection_IncAllocator(theBlockSize)
{
}
//! Allocate memory with given size. Returns NULL on failure
virtual void* Allocate(const size_t size) Standard_OVERRIDE
{
Standard_Mutex::Sentry aSentry(myMutex);
return NCollection_IncAllocator::Allocate(size);
}
DEFINE_STANDARD_RTTI_INLINE(BRepMesh_IncAllocator, NCollection_IncAllocator)
private:
Standard_Mutex myMutex;
};
#endif

View File

@@ -46,7 +46,6 @@ BRepMesh_FactoryError.hxx
BRepMesh_FastDiscret.hxx
BRepMesh_GeomTool.cxx
BRepMesh_GeomTool.hxx
BRepMesh_IncAllocator.hxx
BRepMesh_IncrementalMesh.cxx
BRepMesh_IncrementalMesh.hxx
BRepMesh_MeshAlgoFactory.cxx