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
  • Answer to OP

    1) Yes, it resets the token counter
    2) No. The block of memory in the OS_SEM is all that is used.
    3) No chance of memory leakage, it will just overwrite the OS_SEM structure (and if anyone if anyone has a token from the semaphore, strange things may happen because they will think they still own it)

Reply
  • Answer to OP

    1) Yes, it resets the token counter
    2) No. The block of memory in the OS_SEM is all that is used.
    3) No chance of memory leakage, it will just overwrite the OS_SEM structure (and if anyone if anyone has a token from the semaphore, strange things may happen because they will think they still own it)

Children
No data
More questions in this forum