Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorJb Evain <jbevain@gmail.com>2013-06-07 23:32:11 +0400
committerJb Evain <jbevain@gmail.com>2013-06-08 01:51:47 +0400
commit53e77d3628efe058639755cbc14a3bffaf47a18e (patch)
tree8ec829a53ea27ba8ee39c30ab4501bb39e54f24c /mcs
parent896975c58ebfe1fdcb6b7a16943b2d5fce3dd535 (diff)
Prevent multiple threads to populate the keyword table
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
index e5d9e5e7e66..0f8322efc76 100644
--- a/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
+++ b/mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs
@@ -1597,9 +1597,13 @@ namespace Mono.CSharp
static void FillKeywordTable ()
{
- keywordsTable = new Hashtable ();
- foreach (string keyword in keywords) {
- keywordsTable.Add (keyword, keyword);
+ lock (keywords) {
+ if (keywordsTable == null) {
+ keywordsTable = new Hashtable ();
+ foreach (string keyword in keywords) {
+ keywordsTable.Add (keyword, keyword);
+ }
+ }
}
}