Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Files

os.h/os_mutex.c

Prototype

Code Block
void  OSMutexCreate (OS_MUTEX  *p_mutex,
                     CPU_CHAR  *p_name,
                     OS_ERR    *p_err)

Arguments

p_mutex

is a pointer to a mutex control block that must be allocated in the application. The user will need to declare a “global” variable as follows, and pass a pointer to this variable to OSMutexCreate():

...

  1. Mutexes must be created before they are used.

Example Usage

Code Block
titleOSMutexCreate() example usage
          OS_MUTEX  DispMutex;
           
           
          void main (void)
          {
              OS_ERR  err;
            
           
              :
              OSInit(&err);                         /* Initialize µC/OS-III         */
              :
              :
              OSMutexCreate(&DispMutex,             /* Create Display Mutex         */
                            "Display Mutex",
                            &err);
              /* Check "err" */
           
              :
              :
              OSStart(&err);                        /* Start Multitasking           */
          }