Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

MicroC-OSII mutexs

does anyone know if you can define multiple mutexs in microC OS 2?

I have more than one shared resource that I would like to have different semaphores for. But I would like to use mutex semaphores.

Based on the microC OS 2 book, it seems like you can only make 1 mutex :confused:

am i missing something?

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    maybe he has a mistake in his example in chapter 8.1 of his book?

    He has a line of code that says

    OSMutexCreate(9,&err);

    I think maybe this should read

    ResourceMutex = OSMutexCreate(9,&err);

    ???

    I guess the question is do you need to create an OS_EVENT* type and set it eqaual to OSMutexCreate() ?

    It must just be a mistake in the documentation. Can someone confirm?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    My uC/OS-2 manual reads

    DispMutex = OSMutexCreate(20, &err);

    Based on this i see no reason why there should be not more then 1 Mutex in a System.

    What you need to do is reserve enough space for the event control blocks in the system lib settings.

    karsten