Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Created Unassigned: Concurrency management and performance in TokenSeparatorProvider.cs [15208]

$
0
0
Concurrency seems not to be managed properly in TokenSeparatorProvider.cs:
* A lock is performed on a variable that is exposed externally (_tokens)
* A lock is not performed on a variable while it could be read/written by other
* Some search operations are performed more times then necessary (return _tokens.ContainsKey(item) && _tokens[item].TokenType == TokenType.Operator;)

Suggestion:
* create a new private static variable of type object called lockobject (for example!) and initialize it in the static constructor
* remove _isInitialized and _mutex
* in Init, avoid to lock _tokens; lock the newly added variable lockobject instead
* implement public bool IsOperator(string item) using dictionary's TryGetValue method
* when scanning _tokens in IsOperator(string item), lock lockobject again

Viewing all articles
Browse latest Browse all 2262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>