This:
typedef HRESULT (*PFN_HANDLE)(ClassName&);
It’s used like this:
DWORD ClassName::Wait(PFN_HANDLE pfnh_foo)
{
while (!done) {
waitCode = WaitForMultipleObjects(paramA, paramB, paramC, paramD)
if (waitCode == WAIT_OBJECT_0)
{
pfnh_foo(*this);
}
else
done;
}
return waitCode;
}
It appears that Wait does nothing except block when it gets to WaitForMultipleObjects and then after that does this strange pfnh_foo thing and either loops back around to wait again or exits
Your
wait()function basically waits for multiple objects and then invoke function using function pointerPFN_HANDLEif the wait is successful ( indicated by return valueWAIT_OBJECT_0).This calls the function pointed by pfnh_foo with argument *this.
Lets say we have function:
Wait will be invoked like this: