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
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-05-11 20:06:42 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-05-11 20:06:42 +0400
commitec3393747f98d19df000dfbad1189bfb44897fb2 (patch)
tree83cc4209f9513be11c33458a9944883047fccdba /mcs/class/System/System.Timers
parent10ae4cb6c5cd997bba35c918770f23a1e523e2e4 (diff)
2004-05-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Timer.cs: if AutoReset, disable the timer before adding the callback to the ThreadPool. Patch by Tim Fries <timf@dicecorp.com>. Fixes bug #57993. svn path=/trunk/mcs/; revision=27114
Diffstat (limited to 'mcs/class/System/System.Timers')
-rw-r--r--mcs/class/System/System.Timers/ChangeLog6
-rw-r--r--mcs/class/System/System.Timers/Timer.cs9
2 files changed, 11 insertions, 4 deletions
diff --git a/mcs/class/System/System.Timers/ChangeLog b/mcs/class/System/System.Timers/ChangeLog
index 7d284ee7245..da3f9bd3a6d 100644
--- a/mcs/class/System/System.Timers/ChangeLog
+++ b/mcs/class/System/System.Timers/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Timer.cs: if AutoReset, disable the timer before adding the callback
+ to the ThreadPool. Patch by Tim Fries <timf@dicecorp.com>. Fixes bug
+ #57993.
+
2003-03-17 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Timer.cs: Elapsed is an event. Added a few attributes.
diff --git a/mcs/class/System/System.Timers/Timer.cs b/mcs/class/System/System.Timers/Timer.cs
index 382ee8b8708..b3d413f4cc4 100644
--- a/mcs/class/System/System.Timers/Timer.cs
+++ b/mcs/class/System/System.Timers/Timer.cs
@@ -136,9 +136,6 @@ namespace System.Timers
static void Callback (object state)
{
Timer timer = (Timer) state;
- if (timer.autoReset == false)
- timer.enabled = false;
-
if (timer.Elapsed == null)
return;
@@ -156,8 +153,12 @@ namespace System.Timers
wait = new ManualResetEvent (false);
WaitCallback wc = new WaitCallback (Callback);
- while (enabled && wait.WaitOne ((int) interval, false) == false)
+ while (enabled && wait.WaitOne ((int) interval, false) == false) {
+ if (autoReset == false)
+ enabled = false;
+
ThreadPool.QueueUserWorkItem (wc, this);
+ }
wc = null;
((IDisposable) wait).Dispose ();