|
有看过ACE_win32_proactor实现的代码的兄弟么
小生有个问题
ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds)
{
OVERLAPPED *overlapped = 0;
u_long bytes_transferred = 0;
ULONG completion_key = 0;
// Get the next asynchronous operation that completes
BOOL result = ::GetQueuedCompletionStatus (this->completion_port_,
&bytes_transferred,
&completion_key,
&overlapped,
milli_seconds);
// Narrow the result.
ACE_WIN32_Asynch_Result *asynch_result = (ACE_WIN32_Asynch_Result *) overlapped;
u_long result_err = asynch_result->error ();
// Call completion hook
asynch_result->complete (bytes_transferred,
error ? 0 : 1,
(void *) completion_key,
error);
}
overlapped 指向::GetQueuedCompletionStatus 分配的一快内存,这应该是个WIN32 SDK的结构体
但是下面还有一句: ACE_WIN32_Asynch_Result *asynch_result = (ACE_WIN32_Asynch_Result *) overlapped;
ACE中把这个overlapped强转成了一个ACE_WIN32_Asynch_Result指针
然后居然还call这个指针指的对象的函数
u_long result_err = asynch_result->error ();
// Call completion hook
asynch_result->complete (bytes_transferred,
error ? 0 : 1,
(void *) completion_key,
error);
这是怎么回事情啊! |
|