Skip to content

Commit

Permalink
odb: removing unnecessary locks
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Yuki Imamura <[email protected]>
  • Loading branch information
LucasYuki committed Jan 13, 2025
1 parent 894004c commit c8de0ed
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/odb/include/odb/lefin.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class lefinReader
lefinReader(dbDatabase* db,
utl::Logger* logger,
bool ignore_non_routing_layers);
~lefinReader();
~lefinReader() = default;

// Skip macro-obstructions in the lef file.
void skipObstructions() { _skip_obstructions = true; }
Expand Down
12 changes: 0 additions & 12 deletions src/odb/src/defin/defin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,73 +43,61 @@ std::mutex defin::_def_mutex;

defin::defin(dbDatabase* db, utl::Logger* logger, MODE mode)
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader = new definReader(db, logger, mode);
}

defin::~defin()
{
std::lock_guard<std::mutex> lock(_def_mutex);
delete _reader;
}

void defin::skipConnections()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->skipConnections();
}

void defin::skipWires()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->skipWires();
}

void defin::skipSpecialWires()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->skipSpecialWires();
}

void defin::skipShields()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->skipShields();
}

void defin::skipBlockWires()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->skipBlockWires();
}

void defin::skipFillWires()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->skipFillWires();
}

void defin::continueOnErrors()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->continueOnErrors();
}

void defin::namesAreDBIDs()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->namesAreDBIDs();
}

void defin::setAssemblyMode()
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->setAssemblyMode();
}

void defin::useBlockName(const char* name)
{
std::lock_guard<std::mutex> lock(_def_mutex);
_reader->useBlockName(name);
}

Expand Down
5 changes: 3 additions & 2 deletions src/odb/src/lefin/lefTechLayerCutSpacingTableParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ void createOrthongonalSubRule(
odb::dbTechLayerCutSpacingTableOrthRule* rule
= odb::dbTechLayerCutSpacingTableOrthRule::create(parser->layer);
std::vector<std::pair<int, int>> table;
table.reserve(params.size());
for (const auto& item : params)
table.push_back({lefinReader->dbdist(at_c<0>(item)),
lefinReader->dbdist(at_c<1>(item))});
table.emplace_back(lefinReader->dbdist(at_c<0>(item)),
lefinReader->dbdist(at_c<1>(item)));
rule->setSpacingTable(table);
}
void createDefSubRule(odb::lefTechLayerCutSpacingTableParser* parser)
Expand Down
6 changes: 0 additions & 6 deletions src/odb/src/lefin/lefin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ void lefinReader::init()
}
}

lefinReader::~lefinReader()
{
}

dbSite* lefinReader::findSite(const char* name)
{
dbSite* site = _lib->findSite(name);
Expand Down Expand Up @@ -2437,13 +2433,11 @@ lefin::lefin(dbDatabase* db,
utl::Logger* logger,
bool ignore_non_routing_layers)
{
std::lock_guard<std::mutex> lock(_lef_mutex);
_reader = new lefinReader(db, logger, ignore_non_routing_layers);
}

lefin::~lefin()
{
std::lock_guard<std::mutex> lock(_lef_mutex);
delete _reader;
}

Expand Down

0 comments on commit c8de0ed

Please sign in to comment.