* ThreadPool.cs: Added GetMinThreads and SetMinThreads.
authorLluis Sanchez <lluis@novell.com>
Thu, 15 Apr 2004 14:40:58 +0000 (14:40 -0000)
committerLluis Sanchez <lluis@novell.com>
Thu, 15 Apr 2004 14:40:58 +0000 (14:40 -0000)
* Timer.cs: In Change, return false if the timer has been disposed.
In Dispose, notify the WaitHandle.

svn path=/trunk/mcs/; revision=25552

mcs/class/corlib/System.Threading/ChangeLog
mcs/class/corlib/System.Threading/ThreadPool.cs
mcs/class/corlib/System.Threading/Timer.cs

index 6594cf4d11e77d46602234e865589864af642cec..a4563e0cc118772800d1e56501d50d6f2cf78ae3 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-15  Lluis Sanchez Gual <lluis@ximian.com>
+
+       * ThreadPool.cs: Added GetMinThreads and SetMinThreads.
+       * Timer.cs: In Change, return false if the timer has been disposed.
+       In Dispose, notify the WaitHandle.
+
 2004-04-11  Lluis Sanchez Gual <lluis@ximian.com>
 
        * ReaderWriterLock.cs: More fixes: never wait where acquiring a reader lock
index 25762fabb05c7da7599ec39cbc025136f3e6f4d1..becce6c5355ce21b59a5b15bb335b3b2cfc85179 100755 (executable)
@@ -35,6 +35,12 @@ namespace System.Threading {
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                public static extern void GetMaxThreads (out int workerThreads, out int completionPortThreads);
                        
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern void GetMinThreads (out int workerThreads, out int completionPortThreads);
+                       
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public static extern void SetMinThreads (int workerThreads, int completionPortThreads);
+                       
                public static bool QueueUserWorkItem (WaitCallback callback)
                {
                        IAsyncResult ar = callback.BeginInvoke (null, null, null);
index e4b24f4cdcd2158ab78980e740964dad64c1a4ce..89866b9f681f8c52670e6ac157328385243e49ed 100755 (executable)
@@ -154,7 +154,6 @@ namespace System.Threading
                        t.Start ();
                }
 
-               [MonoTODO("false return?")]
                public bool Change (int dueTime, int period)
                {
                        if (dueTime < -1)
@@ -163,6 +162,9 @@ namespace System.Threading
                        if (period < -1)
                                throw new ArgumentOutOfRangeException ("period");
 
+                       if (runner == null)
+                               return false;
+                       
                        runner.DueTime = dueTime;
                        runner.Period = period;
                        runner.Abort ();
@@ -209,11 +211,11 @@ namespace System.Threading
                        GC.SuppressFinalize (this);
                }
 
-               [MonoTODO("How do we signal the handler?")]
                public bool Dispose (WaitHandle notifyObject)
                {
                        Dispose ();
-                       return true; //FIXME
+                       NativeEventCalls.SetEvent_internal (notifyObject.Handle);
+                       return true;
                }
 
                ~Timer ()