diff options
author | Jb Evain <jbevain@gmail.com> | 2013-06-07 23:32:11 +0400 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2013-06-08 01:51:47 +0400 |
commit | 53e77d3628efe058639755cbc14a3bffaf47a18e (patch) | |
tree | 8ec829a53ea27ba8ee39c30ab4501bb39e54f24c /mcs | |
parent | 896975c58ebfe1fdcb6b7a16943b2d5fce3dd535 (diff) |
Prevent multiple threads to populate the keyword table
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/System/Microsoft.CSharp/CSharpCodeGenerator.cs | 10 |
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); + } + } } } |