Hello,
µVision V5.12, CMSIS OS RTX V4.75
It seemed to me, that a binary Semaphore does not work correctly with my test code. osSemaphoreWait returns a value of 4, but it is a binary semaphore. Do I missunderstand something?
// compile without optimizations, level 0. #include "cmsis_os.h" osSemaphoreDef(sema); osSemaphoreId sema; int main (void) { int32_t tokens; sema = osSemaphoreCreate(osSemaphore(sema),1); /* create binary sema max count of tokens should be 1 */ osSemaphoreRelease(sema); // try to increment sema osSemaphoreRelease(sema); // try to increment sema osSemaphoreRelease(sema); // try to increment sema tokens = osSemaphoreWait(sema,0); // the value of tokens is 4 after // execution, though I limited the sema counter to 1 token // is this a bug? }
Thanks for reply
Thomas