Just now I translated Jon Skeet's WaitHandle.WaitAny / .WaitAll
(<http://yoda.arachsys.com/csharp/threads/waithandles.shtml>) from C#
into VB.NET, and after the first go I ran into trouble:
(from the docs for WaitHandle.WaitAll)
NotSupportedException The number of objects in waitHandles is greater
than the system permits.
-or-
The current thread is marked with the STAThreadAttribute, and
waitHandles contains more than one element.
After digging a bit, I came to the conclusion that VB.NET apps, even
ones that aren't explicitly marked for COM Interop, are STA threaded by
default, so a simple application of the MTAThread attribute to my Main
method fixed the problem.
However, what would I do if I had a real app that *needed* to be
STAThread'd, and I wanted to wait for multiple signals? The docs offer
no justification, just a blunt
Note The WaitAll method is not supported on threads that are marked
with STAThreadAttribute.
Why not? And what could one do about it?
--
Larry Lard
Replies to group please