Created
July 9, 2016 02:15
-
-
Save xixitalk/5c176a78a8743465061ef15ab5f9a248 to your computer and use it in GitHub Desktop.
UINT32引起的死循环
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SINT32 txsem_count_init(Semaphore *ptxSem) | |
{ | |
UINT32 i = 0; | |
UINT32 semCount = 0; | |
UINT32 Count = 0; | |
semCount = GetSemaphoreCount(ptxSem); | |
Count = SEM_INIT_NUM - semCount; | |
if (Count > 0) | |
{ | |
for( i=0;i<Count;i++) | |
{ | |
PutSemaphore(ptxSem); | |
} | |
} | |
else if (Count < 0) | |
{ | |
Count = 0 - Count; | |
for(i = 0;i<Count;i++) | |
{ | |
GetSemaphore(ptxSem); | |
} | |
} | |
return SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment