Difference between KeWaitForSingleObject with 0 timeout and KeReadStateSemaphore
Is there any difference between KeWaitForSingleObject
with timeout set t开发者_JAVA百科o 0 and KeReadStateSemaphore
?
There is a very big difference. While KeReadStateSemaphore
simply returns the state of the semaphore, KeWaitForSingleObject
with a timeout of 0 will actually process side-effects should the wait be satisfied (i.e. the side-effect is to decrement the signal state). Use the former to poll, and use the latter to try to acquire a semaphore without waiting.
精彩评论