MSDN中关于完成端口相应API的翻译

GetQueuedCompletionStatus Function

Attempts to dequeue an I/O completion packet from the specified I/O completion port. If there is no completion packet queued, the function waits for a pending I/O operation associated with the completion port to complete.

尝试从指定的完成端口中出队一个完成I/O包.如果没有完成包出列,函数会等待与该完成端口有关的一个正在处理的I/O操作,直至该I/O完成.

If the function dequeues a completion packet for a successful I/O operation from the completion port, the return value is nonzero. The function stores information in the variables pointed to by the lpNumberOfBytes, lpCompletionKey, and lpOverlapped parameters.

函数返回成功(即非零)的情况,如果函数从完成端口中出列一个成功的I/O操作的完成包,函数返回非零值.同时函数将在lpNumberOfBytes,lpCompletionKey,lpOverlapped参数保存获取的数据大小,PER_HANDLE_DATA,PER_IO_OPERATION_DATA

If *lpOverlapped is NULL and the function does not dequeue a completion packet from the completion port, the return value is zero. The function does not store information in the variables pointed to by the lpNumberOfBytes and lpCompletionKey parameters. To get extended error information, call GetLastError. If the function did not dequeue a completion packet because the wait timed out, GetLastError returns WAIT_TIMEOUT.

函数返回失败(返回值为0)的情况1,如果lpOverlapped(即PER_IO_OPERATION_DATA)为空,即函数没有从完成端口中出列一个完成包,函数返回0.同时函数不会保存相应值的指针.

获取更多的错误信息,可通过调用GetLastError函数.

如果因为超时,函数没有出列一个完成包,GetLastError返回WAIT_TIMEOUT.

If *lpOverlapped is not NULL and the function dequeues a completion packet for a failed I/O operation from the completion port, the return value is zero. The function stores information in the variables pointed to by lpNumberOfBytes, lpCompletionKey, and lpOverlapped. To get extended error information, call GetLastError.

函数返回失败(返回值为0)的情况2,如果lpOverlapped不为空,但是函数出列了一个执行了一个错误的I/O操作的完成包.同时函数保存了相关的值的指针.通过GetLastError获取错误码.

这个返回值解释一下,当完成端口处理了一个错误的句柄时,其实这个时候返回的lpOverlapped信息包含了一个异常的的提示,本质上不算一个错误.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值