This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL-ARM Multiple initiations of Semaphore

Hi,

I'm using the RT-lib and was wondering what happens if a semaphore is initiated multiple times during.

Does this reset the token-counter of the semaphore, or will it simply return without doing anything at all?

Is the semaphore registered somewhere when os_sem_init() is called that could mean memory leakage if it is initiated multiple times?

I'm thankful for any answers.

Best Regards
/Ake Forslund

Parents
  • Ã…ke,
    The below text is my opinion - I don't know for sure!
    It does not make sense that re-initializing a synchronization primitive would break other pieces of software - if there are tasks waiting for that semaphore, resetting its counter will potentially cause a disaster, that might stem from a silly programming mistake. It is more likely that the semaphore is left alone if there are tasks waiting on it, but you should ask Keil support to be sure. If you have access to the memory manager, you might be able to determine whether there is a memory leak or not.

Reply
  • Ã…ke,
    The below text is my opinion - I don't know for sure!
    It does not make sense that re-initializing a synchronization primitive would break other pieces of software - if there are tasks waiting for that semaphore, resetting its counter will potentially cause a disaster, that might stem from a silly programming mistake. It is more likely that the semaphore is left alone if there are tasks waiting on it, but you should ask Keil support to be sure. If you have access to the memory manager, you might be able to determine whether there is a memory leak or not.

Children
No data