Asynchronous mechanism-Overlapped

Source: Internet
Author: User

1 in front of the bwait meaning of GetOverlappedResult

The bwait meaning of GetOverlappedResult indicates whether it is necessary to wait, if IO is still in the pending state, the internal approximate implementation is like this

Hobject = lpoverlapped->hevent? lpoverlapped->hevent:hfile;
Waitstatus = WaitForSingleObject (hobject, INFINITE);

Why overlapped inside to have hevent this field, why use? Suppose such a scenario, open a file handle, initiate multiple asynchronous read requests, and how does the request complete know which read request to correspond to? By hfile, it is clear that there is no need to allocate an event for each IO request, and when the IO is complete, the event is set to a trusted state. Because WaitForMultipleObjectsEx can only deliver up to 64 handles, requests that can be processed at the same time are limited to 64

Asynchronous mechanism-Overlapped

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.