Ensure the linker can eliminate the *RequestCreator code without extra instructions.
[mono.git] / mcs / class / IBM.Data.DB2 / IBM.Data.DB2 / DB2Environment.cs
old mode 100755 (executable)
new mode 100644 (file)
index 1a5cee3..8a2d87e
@@ -1,3 +1,24 @@
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
 using System;\r
 using System.Collections;\r
 \r
@@ -6,7 +27,8 @@ namespace IBM.Data.DB2
 \r
        internal sealed class DB2Environment : IDisposable\r
        {\r
-               private static DB2Environment environment;\r
+               volatile static DB2Environment environment;
+               static readonly object lockobj = new object ();\r
                internal Hashtable connectionPools;\r
                internal IntPtr penvHandle = IntPtr.Zero;\r
 \r
@@ -28,7 +50,7 @@ namespace IBM.Data.DB2
                        {\r
                                if(environment == null)\r
                                {\r
-                                       lock(typeof(DB2Environment))\r
+                                       lock(lockobj)\r
                                        {\r
                                                if(environment == null)\r
                                                {\r