问题
I'm working with some Visual Basic for Applications (VB 6.3) code written by someone else, and they've written:
WaitForSingleObject SEI.hProcess, -1
The process this appears in is supposed to return some data in a text box; sometimes it fails to return anything, and I think it's because of this, possibly because it's its timing out. Is that code the same as:
WaitForSingleObject SEI.hProcess, INFINITE
???
Thanks for your help.
回答1:
The timeout for WaitForSingleObject is actually a DWORD
, which is an unsigned 32 bit integer. INFINITE
is defined as 0xFFFFFFFF
, but -1 mapped into an unsigned type wraps and becomes this value in most integer representations.
Is that code the same as:
Effectively, yes.
来源:https://stackoverflow.com/questions/19578949/in-waitforsingleobject-is-timeout-infinite-the-same-as-timeout-1