What is. NET asynchronous mechanism (APM core IAsyncResult)

Source: Internet
Author: User
Tags apm bool

The core of Asynchrony: IAsyncResult

Asynchronous Programming Model

The whole asynchronous call process is around IAsyncResult, you can look at the example of the previous article, BeginXXX return this object, endxxx receive this object to end the current asynchronous object, let's look at the IAsyncResult interface member/ and AsyncResult class members that implement this interface (some of which are already covered in the previous article)

IAsyncResult interface

1public interface IAsyncResult
2 {
3 WaitHandle asyncwaithandle {get;}//Block a thread until one or more synchronization objects receive the signal
4 Bo Olean iscompleted {get;}//interpret whether the current asynchronous completes
5 Object asyncstate {getting;}///obtain additional parameter values, see the code 4.3
6 Boolean C for an article ompletedsynchronously {get;}///Almost no use of
7}

AsyncResult class

1 public class Asyncresult:iasyncresult, IMessageSink
2 {
3//iasyncresult implementation
4 public virtual W Aithandle asyncwaithandle {get;}
5 public virtual bool iscompleted {get;}
6 Public virtual object asyncstate {get;}
7 public virtual bool completedsynchronously {get;}
8
9//Other important attributes ten public
bool endinvokecalled {get; set;}//Check whether to invoke EndInvoke () one public
virtual Object AsyncDelegate {get;}//Gets the original delegate object to view the code 4.1/4.2/5 12} in the previous article

Note: Basically read-only properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.