PostQueuedCompletionStatus Subroutine
Purpose
Post a completion packet to a specified I/O completion port.
Syntax
#include <iocp.h>
boolean_t PostQueuedCompletionStatus (CompletionPort, TransferCount, CompletionKey, Overlapped, )
HANDLE CompletionPort;
DWORD TransferCount, CompletionKey;
LPOVERLAPPED Overlapped;
Description
The PostQueuedCompletionStatus subroutine attempts to post a completion packet to CompletionPort with the values of the completion packet populated by the TransferCount, CompletionKey, and Overlapped parameters.
The PostQueuedCompletionStatus subroutine returns a boolean indicating whether or not a completion packet has been posted.
The PostQueuedCompletionStatus subroutine is part of the I/O Completion Port (IOCP) kernel extension.
Note: This subroutine only works to a socket file descriptor. It does
not work with files or other file descriptors.
Parameters
Item | Description |
---|---|
CompletionPort | Specifies the completion port that this subroutine will attempt to access. |
TransferCount | Specifies the number of bytes transferred. |
CompletionKey | Specifies the completion key. |
Overlapped | Specifies the overlapped structure. |
Return Values
Upon successful completion, the PostQueuedCompletionStatus subroutine returns a boolean indicating its success.
If the PostQueuedCompletionStatus subroutine is unsuccessful,
the subroutine handler performs the following functions:
- Returns a value of 0 to the calling program.
- Moves an error code, indicating the specific error, into the errno global variable. For further explanation of the errno variable, see the link in the Related Information section of this document.
Error Codes
The subroutine is unsuccessful if either of the following errors
occur:
Item | Description |
---|---|
EBADF | The CompletionPort parameter was NULL. |
EINVAL | The CompletionPort parameter was invalid. |
Examples
The following program fragment illustrates the use of the PostQueuedCompletionStatus subroutine
to post a completion packet.
c = GetQueuedCompletionStatus (34, 128, 25, struct overlapped);