共用方式為


RIOResizeCompletionQueue function

The RIOResizeCompletionQueue function resizes an I/O completion queue to be either larger or smaller for use with the Winsock registered I/O extensions.

Syntax

BOOL  RIOResizeCompletionQueue(
  _In_ RIO_CQ CQ,
  _In_ DWORD  QueueSize
);

Parameters

  • CQ [in]
    A descriptor that identifies an existing I/O completion queue to resize.

  • QueueSize [in]
    The new size, in number of entries, of the completion queue.

Return value

If no error occurs, the RIOResizeCompletionQueue function returns TRUE. Otherwise, a value of FALSE is returned, and a specific error code can be retrieved by calling the WSAGetLastError function.

Return code Description
WSAEFAULT

The system detected an invalid pointer address in attempting to use a pointer argument in a call. This error is returned if the completion queue specified in the CQ parameter contains an invalid pointer.

WSAEINVAL

An invalid parameter was passed to the function. This error is returned if the CQ parameter is not valid (RIO_INVALID_CQ, for example). This error is also returned if the size of the queue specified in the QueueSize parameter is greater than RIO_CQ_MAX_SIZE.

WSAENOBUFS

Sufficient memory could not be allocated. This error is returned if memory could not be allocated for the queue specified in the QueueSize parameter.

WSAETOOMANYREFS

There are too many operations that still reference the I/O completion queue. Resizing of this I/O completion queue to be smaller is not possible at this time.

 

Remarks

The RIOResizeCompletionQueue function resizes an I/O completion queue to be either larger or smaller. If the I/O completion queue already contains completions, those completions will be copied over to the new completion queue.

I/O completion queues have a required minimum size that is dependent on the number of request queues associated with the completion queue and the number of sends and receives on the request queues. If an application calls the RIOResizeCompletionQueue function and tries to set the queue too small for the number of existing completions in the I/O completion queue, the call will fail and the queue will not be resized.

Note  The function pointer to the RIOResizeCompletionQueue function must be obtained at run time by making a call to the WSAIoctl function with the SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER opcode specified. The input buffer passed to the WSAIoctl function must contain WSAID_MULTIPLE_RIO, a globally unique identifier (GUID) whose value identifies the Winsock registered I/O extension functions. On success, the output returned by the WSAIoctl function contains a pointer to the RIO_EXTENSION_FUNCTION_TABLE structure that contains pointers to the Winsock registered I/O extension functions. The SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER IOCTL is defined in the Ws2def.h header file. The WSAID_MULTIPLE_RIO GUID is defined in the Mswsock.h header file.

 

Windows Phone 8: This function is supported for Windows Phone Store apps on Windows Phone 8 and later.

Windows 8.1 and Windows Server 2012 R2: This function is supported for Windows Store apps on Windows 8.1, Windows Server 2012 R2, and later.

Thread Safety

If multiple threads attempt to access the same RIO_CQ using the RIODequeueCompletion or RIOResizeCompletionQueue function, access must be coordinated by a critical section, slim reader writer lock , or similar mutual exclusion mechanism. If the completion queues are not shared, mutual exclusion is not required.

Requirements

Minimum supported client

Windows 8.1, Windows 8 [desktop apps | UWP apps]

Minimum supported server

Windows Server 2012 [desktop apps | UWP apps]

Minimum supported phone

Windows Phone 8

Header

Mswsock.h

Library

Mswsock.lib

DLL

Mswsock.dll

See also

RIO_CQ

RIO_EXTENSION_FUNCTION_TABLE

RIOCloseCompletionQueue

RIOCreateCompletionQueue

RIODequeueCompletion

WSAIoctl