Author: atsushi
Date: 2006-07-04 05:50:41 -0400 (Tue, 04 Jul 2006)
New Revision: 62240

Modified:
   trunk/mcs/class/corlib/System.Threading/ChangeLog
   trunk/mcs/class/corlib/System.Threading/WaitHandle.cs
Log:
2006-07-04  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * WaitHandle.cs : CheckArray() is also used in WaitAny(), so added
          extra argument to skip STAThread check.



Modified: trunk/mcs/class/corlib/System.Threading/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Threading/ChangeLog   2006-07-04 09:04:55 UTC 
(rev 62239)
+++ trunk/mcs/class/corlib/System.Threading/ChangeLog   2006-07-04 09:50:41 UTC 
(rev 62240)
@@ -1,3 +1,8 @@
+2006-07-04  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * WaitHandle.cs : CheckArray() is also used in WaitAny(), so added
+         extra argument to skip STAThread check.
+
 2006-06-30  Duncan Mak  <[EMAIL PROTECTED]>
 
        * WaitHandle.cs (CheckArray): Avoid using reflection unless we

Modified: trunk/mcs/class/corlib/System.Threading/WaitHandle.cs
===================================================================
--- trunk/mcs/class/corlib/System.Threading/WaitHandle.cs       2006-07-04 
09:04:55 UTC (rev 62239)
+++ trunk/mcs/class/corlib/System.Threading/WaitHandle.cs       2006-07-04 
09:50:41 UTC (rev 62240)
@@ -41,7 +41,7 @@
                [MethodImplAttribute(MethodImplOptions.InternalCall)]
                private static extern bool WaitAll_internal(WaitHandle[] 
handles, int ms, bool exitContext);
                
-               static void CheckArray (WaitHandle [] handles)
+               static void CheckArray (WaitHandle [] handles, bool waitAll)
                {
                        if (handles == null)
                                throw new ArgumentNullException ("waitHandles");
@@ -50,7 +50,7 @@
                        if (length > 64)
                                throw new NotSupportedException ("Too many 
handles");
 
-                       if (length > 1 &&
+                       if (waitAll && length > 1 &&
                            (Thread.CurrentThread.ApartmentState == 
ApartmentState.STA ||
                             Assembly.GetEntryAssembly 
().EntryPoint.GetCustomAttributes (typeof (STAThreadAttribute), false).Length 
== 1))
                                throw new NotSupportedException ("WaitAll for 
multiple handles is not allowed on an STA thread.");
@@ -66,13 +66,13 @@
                
                public static bool WaitAll(WaitHandle[] waitHandles)
                {
-                       CheckArray (waitHandles);
+                       CheckArray (waitHandles, true);
                        return(WaitAll_internal(waitHandles, Timeout.Infinite, 
false));
                }
 
                public static bool WaitAll(WaitHandle[] waitHandles, int 
millisecondsTimeout, bool exitContext)
                {
-                       CheckArray (waitHandles);
+                       CheckArray (waitHandles, true);
                        try {
                                if (exitContext) 
SynchronizationAttribute.ExitContext ();
                                return(WaitAll_internal(waitHandles, 
millisecondsTimeout, false));
@@ -86,7 +86,7 @@
                                           TimeSpan timeout,
                                           bool exitContext)
                {
-                       CheckArray (waitHandles);
+                       CheckArray (waitHandles, true);
                        long ms = (long) timeout.TotalMilliseconds;
                        
                        if (ms < -1 || ms > Int32.MaxValue)
@@ -107,7 +107,7 @@
                // LAMESPEC: Doesn't specify how to signal failures
                public static int WaitAny(WaitHandle[] waitHandles)
                {
-                       CheckArray (waitHandles);
+                       CheckArray (waitHandles, false);
                        return(WaitAny_internal(waitHandles, Timeout.Infinite, 
false));
                }
 
@@ -115,7 +115,7 @@
                                          int millisecondsTimeout,
                                          bool exitContext)
                {
-                       CheckArray (waitHandles);
+                       CheckArray (waitHandles, false);
                        try {
                                if (exitContext) 
SynchronizationAttribute.ExitContext ();
                                return(WaitAny_internal(waitHandles, 
millisecondsTimeout, exitContext));
@@ -128,7 +128,7 @@
                public static int WaitAny(WaitHandle[] waitHandles,
                                          TimeSpan timeout, bool exitContext)
                {
-                       CheckArray (waitHandles);
+                       CheckArray (waitHandles, false);
                        long ms = (long) timeout.TotalMilliseconds;
                        
                        if (ms < -1 || ms > Int32.MaxValue)

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

Reply via email to