|
-
Jan 4th, 2009, 07:32 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] [2008] WaitAll for multiple handles on a STA thread is not supported
I am using the ThreadPool for some background processing (see this thread) and because I don't know any better, I made my code use WaitHandles and AutoResetEvents. The problem is that I'm getting a NotSupportedException on the WaitHandle.WaitAll(waitHandles) line, saying the following: "WaitAll for multiple handles on a STA thread is not supported.". I've added the <MTAThreadAttribute()> attribute before the method using WaitHandles, however this has no effect. Any ideas? And may setting MTA instead of STA have any unwanted side-effects? I don't want to solve one problem by creating a hundred more...
A solution which uses a different method to notify the main thread of the completion of the worker threads would also be acceptable.
@jmcilhinney: I remember you posted a link to the MSDN website, to a part which explained multi-threading and async operations, however I am sorry to say that it was too complex for me to understand well enough to be able to use it on my own... Thank you anyway, since I believe the link will be of great use to me as soon as I have learned enough to understand it.
Please rate helpful ppl's posts. It's the best 'thank you' you can give 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|