Sunday, March 18th 2018, 8:00pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.



Date of registration: Mar 1st 2018

Posts: 1


Thursday, March 1st 2018, 4:15pm

semaphore already created?


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


OS_RSEMA* sema = NULL;


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

I'm using embOS 3.60d


Super Moderator

Date of registration: Nov 14th 2007

Posts: 265


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;


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,