Author: lluis
Date: 2006-01-31 14:45:43 -0500 (Tue, 31 Jan 2006)
New Revision: 56357

Modified:
   trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog
   trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/Lease.cs
Log:
2006-01-31  Lluis Sanchez Gual  <[EMAIL PROTECTED]>

        * Lease.cs: Fixed double check lock.



Modified: trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog   
2006-01-31 19:45:27 UTC (rev 56356)
+++ trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/ChangeLog   
2006-01-31 19:45:43 UTC (rev 56357)
@@ -1,3 +1,7 @@
+2006-01-31  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
+
+       * Lease.cs: Fixed double check lock.
+
 2004-06-07  Lluis Sanchez Gual  <[EMAIL PROTECTED]>
 
        * LeaseManager.cs: In StopManager, nullify the timer variable before

Modified: trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/Lease.cs
===================================================================
--- trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/Lease.cs    
2006-01-31 19:45:27 UTC (rev 56356)
+++ trunk/mcs/class/corlib/System.Runtime.Remoting.Lifetime/Lease.cs    
2006-01-31 19:45:43 UTC (rev 56357)
@@ -118,15 +118,9 @@
 
                public void Register (ISponsor obj, TimeSpan renewalTime)
                {
-                       if (_sponsors == null) 
-                       {
-                               lock (this) {
-                                       if (_sponsors == null)
-                                               _sponsors = new ArrayList();
-                               }
-                       }
-
-                       lock (_sponsors.SyncRoot) {
+                       lock (this) {
+                               if (_sponsors == null)
+                                       _sponsors = new ArrayList();
                                _sponsors.Add (obj);
                        }
 
@@ -143,9 +137,8 @@
 
                public void Unregister (ISponsor obj)
                {
-                       if (_sponsors == null) return;
-                       
-                       lock (_sponsors.SyncRoot) {
+                       lock (this) {
+                               if (_sponsors == null) return;
                                _sponsors.Remove (obj);
                        }
                }
@@ -163,7 +156,7 @@
                        if (_sponsors != null)
                        {
                                _currentState = LeaseState.Renewing;
-                               lock (_sponsors.SyncRoot) {
+                               lock (this) {
                                        _renewingSponsors = new Queue 
(_sponsors);
                                }
                                CheckNextSponsor ();

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to