[SOLVED] semaphore already created?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] semaphore already created?

    Hi,

    is there a way to find out if a semaphore or mailbox is already created?

    like:

    OS_RSEMA* sema = NULL;

    OS_CreateRSema(sema);

    if(sema != NULL){
    printf("sema exists");
    }

    I'm using embOS 3.60d
  • Hi Axel,

    no, there is unfortunately no easy way and I don't think you example will work like that since you have only declared a pointer but not the variable itself.
    Usually it would be something like:

    OS_RSEMA sema;

    OS_CreateRSema(&sema);

    But &sema has also a valid value before OS_CreateRSema() .

    With the debug build of embOS you could check sema.Id which gets a valid value when the semaphore is created.
    But this Id member is only available in embOS debug builds.

    Best regards,
    Til
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.