有关IOCP函数的问题
最近看这个,发现有点儿地方不太懂,希望搞明白的同志给说说在IOCP的工作经程中需要用到一个这样的函数
BOOL GetQueuedCompletionStatus(
HANDLE CompletionPort, // handle to completion port
LPDWORD lpNumberOfBytes, // bytes transferred
PULONG_PTR lpCompletionKey, // file completion key
LPOVERLAPPED *lpOverlapped, // buffer
DWORD dwMilliseconds // optional timeout value
);
第三个别参数好像是:Pointer to a ULONG
第四个参数是:指向OVERLAPPED指针的指针.即二级指针
在工作线程中先定义两个结构体如下:
typedef struct
{
OVERLAPPED Overlapped;
WSABUF DataBuf;
CHAR Buffer[DATA_BUFSIZE];
DWORD dwRecv;
} PER_IO_OPERATION_DATA, * LPPER_IO_OPERATION_DATA;
typedef struct
{
SOCKET Socket;
} PER_HANDLE_DATA, * LPPER_HANDLE_DATA;
///////////////////////////////////////////////////////
函数中定义这样两个变量:
LPPER_HANDLE_DATA PerHandleData;
LPPER_IO_OPERATION_DATA PerIoData;
为啥子这样调用呢?
GetQueuedCompletionStatus(CompletionPort, &BytesTransferred, (LPDWORD)&PerHandleData, (LPOVERLAPPED*)&PerIoData, INFINITE)
问题:
第三个参数已经是指针了,为啥子还取地址?