diff options
author | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2004-05-11 20:06:42 +0400 |
---|---|---|
committer | Gonzalo Paniagua Javier <gonzalo.mono@gmail.com> | 2004-05-11 20:06:42 +0400 |
commit | ec3393747f98d19df000dfbad1189bfb44897fb2 (patch) | |
tree | 83cc4209f9513be11c33458a9944883047fccdba /mcs/class/System/System.Timers | |
parent | 10ae4cb6c5cd997bba35c918770f23a1e523e2e4 (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/ChangeLog | 6 | ||||
-rw-r--r-- | mcs/class/System/System.Timers/Timer.cs | 9 |
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 (); |