diff options
Diffstat (limited to 'mcs/class/corlib/System.Threading')
-rw-r--r-- | mcs/class/corlib/System.Threading/ChangeLog | 17 | ||||
-rwxr-xr-x | mcs/class/corlib/System.Threading/Thread.cs | 25 | ||||
-rwxr-xr-x | mcs/class/corlib/System.Threading/Timer.cs | 8 |
3 files changed, 37 insertions, 13 deletions
diff --git a/mcs/class/corlib/System.Threading/ChangeLog b/mcs/class/corlib/System.Threading/ChangeLog index ba1a9664f98..d441965fb9b 100644 --- a/mcs/class/corlib/System.Threading/ChangeLog +++ b/mcs/class/corlib/System.Threading/ChangeLog @@ -1,3 +1,20 @@ +2004-09-16 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Timer.cs: don't invoke the callback twice when the timer changes. + Fixes bug #66116. + +2004-08-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Timer.cs: don't invoke the callback if the period changes before the + due time. Fixes bug #62421. + +2004-07-15 Dick Porter <dick@ximian.com> + + * Thread.cs: Hold a lock in GetNamedDataSlot. Fixes bug 61582, + based on patch by Sébastien Robitaille + (sebastien.robitaille@croesus.com). Also fix instances of + lock(typeof(Thread)) to lock a private object instead. + 2004-06-24 Dick Porter <dick@ximian.com> * Mutex.cs: Implement the createdNew parameter diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 66826e12d40..911fb1dbe12 100755 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -157,9 +157,10 @@ namespace System.Threading // Stores a hash keyed by strings of LocalDataStoreSlot objects static Hashtable datastorehash; - + private static object datastore_lock = new object (); + private static void InitDataStoreHash () { - lock (typeof (Thread)) { + lock (datastore_lock) { if (datastorehash == null) { datastorehash = Hashtable.Synchronized(new Hashtable()); } @@ -167,7 +168,7 @@ namespace System.Threading } public static LocalDataStoreSlot AllocateNamedDataSlot(string name) { - lock (typeof (Thread)) { + lock (datastore_lock) { if (datastorehash == null) InitDataStoreHash (); LocalDataStoreSlot slot = (LocalDataStoreSlot)datastorehash[name]; @@ -186,7 +187,7 @@ namespace System.Threading } public static void FreeNamedDataSlot(string name) { - lock (typeof (Thread)) { + lock (datastore_lock) { if (datastorehash == null) InitDataStoreHash (); LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; @@ -210,15 +211,17 @@ namespace System.Threading public extern static int GetDomainID(); public static LocalDataStoreSlot GetNamedDataSlot(string name) { - if (datastorehash == null) - InitDataStoreHash (); - LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; + lock (datastore_lock) { + if (datastorehash == null) + InitDataStoreHash (); + LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; - if(slot==null) { - slot=AllocateNamedDataSlot(name); - } + if(slot==null) { + slot=AllocateNamedDataSlot(name); + } - return(slot); + return(slot); + } } [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/mcs/class/corlib/System.Threading/Timer.cs b/mcs/class/corlib/System.Threading/Timer.cs index 164c60ef2ca..1bba6fa581e 100755 --- a/mcs/class/corlib/System.Threading/Timer.cs +++ b/mcs/class/corlib/System.Threading/Timer.cs @@ -128,6 +128,9 @@ namespace System.Threading wait.Reset (); signaled = wait.WaitOne (period, false); + if (aborted) + break; + if (!signaled) { callback (state); } else if (!WaitForDueTime ()) { @@ -195,10 +198,11 @@ namespace System.Threading if (runner == null) return false; - + + start_event.Reset (); + runner.Abort (); runner.DueTime = dueTime; runner.Period = period; - runner.Abort (); start_event.Set (); return true; } |