mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Avoid data race warning in SmilesParse.cpp (#2946)
* Avoid data race in SmilesParse.cpp Avoid data race in SmilesParse.cpp for SMILES and SMARTS * More informative comments * Fix line width
This commit is contained in:
@@ -347,7 +347,13 @@ Bond *SmilesToBond(const std::string &smiles) {
|
||||
|
||||
RWMol *SmilesToMol(const std::string &smiles,
|
||||
const SmilesParserParams ¶ms) {
|
||||
yysmiles_debug = params.debugParse;
|
||||
// Calling SmilesToMol in a multithreaded context is generally safe *unless*
|
||||
// the value of debugParse is different for different threads. The if
|
||||
// statement below avoids a TSAN warning in the case where multiple threads
|
||||
// all use the same value for debugParse.
|
||||
if (yysmiles_debug != params.debugParse) {
|
||||
yysmiles_debug = params.debugParse;
|
||||
}
|
||||
|
||||
std::string lsmiles, name, cxPart;
|
||||
preprocessSmiles(smiles, params, lsmiles, name, cxPart);
|
||||
@@ -412,7 +418,13 @@ Bond *SmartsToBond(const std::string &smiles) {
|
||||
|
||||
RWMol *SmartsToMol(const std::string &smarts, int debugParse, bool mergeHs,
|
||||
std::map<std::string, std::string> *replacements) {
|
||||
yysmarts_debug = debugParse;
|
||||
// Calling SmartsToMol in a multithreaded context is generally safe *unless*
|
||||
// the value of debugParse is different for different threads. The if
|
||||
// statement below avoids a TSAN warning in the case where multiple threads
|
||||
// all use the same value for debugParse.
|
||||
if (yysmarts_debug != debugParse) {
|
||||
yysmarts_debug = debugParse;
|
||||
}
|
||||
// boost::trim_if(sma,boost::is_any_of(" \t\r\n"));
|
||||
std::string sma;
|
||||
RWMol *res;
|
||||
|
||||
Reference in New Issue
Block a user