Author: duncan
Date: 2006-06-29 12:37:54 -0400 (Thu, 29 Jun 2006)
New Revision: 62144

Modified:
   trunk/mcs/class/corlib/System.Threading/ChangeLog
   trunk/mcs/class/corlib/System.Threading/WaitHandle.cs
Log:
2006-06-29  Duncan Mak  <[EMAIL PROTECTED]>

        * WaitHandle.cs (CheckArray): Throw NotSupportedException if the
        current thread is marked with the STAThreadAttribute. Fixes bug
        #78455.


Modified: trunk/mcs/class/corlib/System.Threading/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Threading/ChangeLog   2006-06-29 16:23:58 UTC 
(rev 62143)
+++ trunk/mcs/class/corlib/System.Threading/ChangeLog   2006-06-29 16:37:54 UTC 
(rev 62144)
@@ -1,3 +1,9 @@
+2006-06-29  Duncan Mak  <[EMAIL PROTECTED]>
+
+       * WaitHandle.cs (CheckArray): Throw NotSupportedException if the
+       current thread is marked with the STAThreadAttribute. Fixes bug
+       #78455.
+
 2006-05-05  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * ExecutionContext.cs: Don't capture the compressed stack unless the 

Modified: trunk/mcs/class/corlib/System.Threading/WaitHandle.cs
===================================================================
--- trunk/mcs/class/corlib/System.Threading/WaitHandle.cs       2006-06-29 
16:23:58 UTC (rev 62143)
+++ trunk/mcs/class/corlib/System.Threading/WaitHandle.cs       2006-06-29 
16:37:54 UTC (rev 62144)
@@ -28,6 +28,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Runtime.Remoting.Contexts;
 using System.Security.Permissions;
@@ -48,6 +50,12 @@
                        if (length > 64)
                                throw new NotSupportedException ("Too many 
handles");
 
+                       MethodInfo entryPoint = Assembly.GetEntryAssembly 
().EntryPoint;
+                       if (length > 1 &&
+                           (Thread.CurrentThread.ApartmentState == 
ApartmentState.STA ||
+                            entryPoint.GetCustomAttributes (typeof 
(STAThreadAttribute), false).Length == 1))
+                               throw new NotSupportedException ("WaitAll for 
multiple handles is not allowed on an STA thread.");
+                       
                        foreach (WaitHandle w in handles) {
                                if (w == null)
                                        throw new ArgumentNullException 
("waitHandles", "null handle");

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

Reply via email to