unicode编码下也可使用char吗,要不要都写成TCHAR*还有个问题哈:在项目代码里看到这一行:while(WaitForSingleObject(MMutex,INFINITE) != WAIT_OBJECT_0);
WaitForSingleObject会自动等待,while多余的吧????我查了资料:WaitForSingleObject、Sleep、SetTimer等都是低精度计时,当指定时间小于10ms时,会自动按10ms计算。(这个10ms可能与系统版本有关,也可能受其它软件影响)
高精度定时可以用timeSetEvent或CreateWaitableTimer、SetWaitableTimer。
请问有必要写while吗?
WaitForSingleObject会自动等待,while多余的吧????我查了资料:WaitForSingleObject、Sleep、SetTimer等都是低精度计时,当指定时间小于10ms时,会自动按10ms计算。(这个10ms可能与系统版本有关,也可能受其它软件影响)
高精度定时可以用timeSetEvent或CreateWaitableTimer、SetWaitableTimer。
请问有必要写while吗?
2、个人觉得while是多余的,既然是无限等待了,这儿就没必要while了
建议都用t系列的,双编译,比较保险。
另外就是真的需要按字节分配内存的时候,BYTE(unsigned char)就不用转了
The specified object is a mutex object that was not released by the thread that owned the mutex object before the owning thread terminated. Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled.If the mutex was protecting persistent state information, you should check it for consistency.
WAIT_ABANDONED
0x00000080L
The specified object is a mutex object that was not released by the thread that owned the mutex object before the owning thread terminated. Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled.If the mutex was protecting persistent state information, you should check it for consistency.
WAIT_OBJECT_0
0x00000000L
The state of the specified object is signaled.
WAIT_TIMEOUT
0x00000102L
The time-out interval elapsed, and the object's state is nonsignaled.
If the function fails, the return value is WAIT_FAILED ((DWORD)0xFFFFFFFF). To get extended error information, call GetLastError.