I've you've given your application entry point the attribute STAThread,
you're telling the runtime, from a COM interop perspective, that your
application has only one thread.  This attribute is not used for COM
interop. unless you use COM interop.  The first use of COM interop. will
initialize COM with this attribute.

I suppose there's nothing stopping other parts of the runtime from
reflecting on your main thread to determine whether or not it has a single-
threaded attribute; but, I don't know why.

If you're spawning multiple threads then you can use the MTAThread
attribute instead of the STAThread attribute.  This won't affect how
external threads are marshaled as they access your application via COM--
they will still only be able to access you one at a time.  You will then
be telling COM you are multi-threaded and have made an attempt to
synchronize your invariants with respect to making external calls via COM
interop. on multiple threads.

http://www.peterRitchie.com/

On Fri, 23 Sep 2005 05:28:28 -0400, Allan N. <[EMAIL PROTECTED]> wrote:

>Hi,
>in my naive attempt to spin off 6 threads and then wait for them to finish
>before filling a grid I got the
>"WaitAll for multiple handles on an STA thread is not supported" message
>flashing in my eyes.
>
>checking the documentation was perhaps the best I could have done before
>going this way :).
>
>what else could I use here instead of WaitAll ? using ManualResetEvent
>[curThread].WaitOne and then looping seems rather tedious...

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to