zoukankan      html  css  js  c++  java
  • C++ Asynchronous IO on Windows

    IO notification has 6 models
    1. synchronous completion for “fast” I/O
    2. polling
    3. signaling the device kernel object directly
    4. signaling an event object provided when I/O started
    5. posting a packet to an I/O completion port
    6. posting an APC to the initiating thread

    Overlapped structure, using it to access the results of asynchronous I/O operation.

    typedef struct _OVERLAPPED {
    ULONG_PTR Internal;
    ULONG_PTR InternalHigh;
    union {
    struct {
    DWORD Offset;
    DWORD OffsetHigh;
    } DUMMYSTRUCTNAME;
    PVOID Pointer;
    } DUMMYUNIONNAME;

    HANDLE hEvent;
    } OVERLAPPED, *LPOVERLAPPED;

    All of the members of the OVERLAPPED structure must be initialized to zero unless an event will be used to signal completion of an I/O operation. If an event is used, the hEvent member of the OVERLAPPED structure specifies a handle to the allocated event object. The system sets the state of the event object to nonsignaled when a call to the I/O function returns before the operation has been completed. The system sets the state of the event object to signaled when the operation has been completed. An event is needed only if there will be more than one outstanding I/O operation at the same time. If an event is not used, each completed I/O operation will signal the file, named pipe, or communications device.

    Most of these fields are for system use only.

  • 相关阅读:
    小事引发的思考
    C++程序设计教程学习(0)-引子
    Cygwin安装
    PATHEXT环境变量简介
    Oracle Real Application Cluster
    SQLNET.AUTHENTICATION_SERVICES参数说明
    用神经网络拟合数据
    用PyTorch自动求导
    用PyTorch做参数估计
    深度学习基础(概念性)
  • 原文地址:https://www.cnblogs.com/rogerroddick/p/2944445.html
Copyright © 2011-2022 走看看