Tuesday, May 22nd 2018, 4:04pm UTC+2

You are not logged in.

  • Login
  • Register

Axel

Beginner

Date of registration: Mar 1st 2018

Posts: 1

1

Thursday, March 1st 2018, 4:15pm

[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

SEGGER - Til

Super Moderator

Date of registration: Nov 14th 2007

Posts: 271

2

Thursday, March 1st 2018, 4:35pm

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