Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Question 1</strong></p> <p>I think part of the problem is misconception. IAsyncResult is not accessed from multiple threads unless you explicitly pass it to one. If you look at the implementation for mos Begin*** style API's in the BCL, you'll notice the IAsyncResult is only ever created and destroyed from the thread where the Begin*** or End*** call actually occur. </p> <p><strong>Question 2</strong></p> <p>AsyncWaitHandle should be signaled after the operation is 100% complete. </p> <p><strong>Question 3</strong></p> <p>IsCompleted should return true once the underlying operation is complete (no more work to do). The best way to view IsComplete is that if the value is</p> <ol> <li>true -> Calling End*** will return immediately</li> <li>false -> Callind End*** will block for some period of time</li> </ol> <p><strong>Question 4</strong></p> <p>This is implementation dependent. There is no way to really give a blanket answer here.</p> <p><strong>Samples</strong></p> <p>If you are interested in an API which allows you to easily run a delegate on another thread and access the result when finished, check out my <a href="http://code.msdn.microsoft.com/RantPack" rel="nofollow noreferrer">RantPack Utility Library</a>. It's available in source and binary form. It has a fully fleshed out Future API which allows for the concurrent running of delegates. </p> <p>Additionally there is an implementation of IAsyncResult which covers most of the questions in this post. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload