Versions Compared

Key

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

This is a pointer to an ASCII string used to provide a name to the mutual exclusion semaphore. The ASCII string can have any length as long as it is NUL terminated.

.PendList.NbrEntries

Each mutual exclusion semaphore contains a list of tasks waiting for the semaphore to be released. The variable represents the number of entries in the wait list.

.OwnerOriginalPrio

This variable holds the original priority of the task that owns the mutual exclusion semaphore.

.OwnerTCBPtr->Prio

Dereferencing the pointer to the OS_TCB of the mutual exclusion semaphore owner allows the application to determine whether a task priority was changed.

.OwnerNestingCtr

This variable indicates how many times the owner of the mutual exclusion semaphore requested the semaphore.

.TS

...

Include Page
css.Migrating from uC-OS-II to uC-OS-III.css
css.Migrating from uC-OS-II to uC-OS-III.css
Include Page
css.webworks.css
css.webworks.css

Anchor
1080022
1080022
Mutual Exclusion Semaphores

Anchor
1080023
1080023
Table C-11 shows the difference in API for mutual exclusion semaphore management.

Anchor
1181579
1181579
 

HTML Table
summary
classPlain_Table
Table Row (tr)
Table Cell (td)

Anchor
1089777
1089777
µC/OS-II (os_mutex.c)

Table Cell (td)

Anchor
1089779
1089779
µC/OS-III (os_mutex.c)

Table Cell (td)

Anchor
1089781
1089781
Note

Table Row (tr)
Table Cell (td)
rowspan5

Anchor
1089783
1089783
BOOLEAN

Anchor
1089789
1089789
OSMutexAccept(

Anchor
1089795
1089795
OS_EVENT *pevent,

Anchor
1089801
1089801
INT8U *perr);

Table Cell (td)
rowspan5

Anchor
1089785
1089785
 

Table Cell (td)
rowspan5

Anchor
1089811
1089811
(1)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)
Table Cell (td)
rowspan5

Anchor
1089813
1089813
OS_EVENT *

Anchor
1089819
1089819
OSMutexCreate(

Anchor
1089825
1089825
INT8U prio,

Anchor
1089831
1089831
INT8U *perr);

Table Cell (td)
rowspan5

Anchor
1090203
1090203
void

Anchor
1090204
1090204
OSMutexCreate(

Anchor
1090205
1090205
OS_MUTEX *p_mutex,

Anchor
1090206
1090206
CPU_CHAR *p_name,

Anchor
1090207
1090207
OS_ERR *p_err);

Table Cell (td)
rowspan5

Anchor
1090209
1090209
(2)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)
Table Cell (td)
rowspan6

Anchor
1089873
1089873
OS_EVENT *

Anchor
1089879
1089879
OSMutexDel(

Anchor
1089885
1089885
OS_EVENT *pevent,

Anchor
1089891
1089891
INT8U opt,

Anchor
1089897
1089897
INT8U *perr);

Table Cell (td)
rowspan6

Anchor
1089905
1089905
void

Anchor
1090238
1090238
OSMutexDel(

Anchor
1090239
1090239
OS_MUTEX *p_mutex,

Anchor
1090240
1090240
OS_OPT opt,

Anchor
1090230
1090230
OS_ERR *p_err);

Table Cell (td)
rowspan6

Anchor
1089877
1089877
 

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)
Table Cell (td)
rowspan6

Anchor
1089939
1089939
void

Anchor
1089945
1089945
OSMutexPend(

Anchor
1089951
1089951
OS_EVENT *pevent,

Anchor
1089957
1089957
INT32U timeout,

Anchor
1089963
1089963
INT8U *perr);

Table Cell (td)
rowspan6

Anchor
1090272
1090272
void

Anchor
1090273
1090273
OSMutexPend(

Anchor
1090274
1090274
OS_MUTEX *p_mutex,

Anchor
1090275
1090275
OS_TICK timeout,

Anchor
1090276
1090276
OS_OPT opt,

Anchor
1090277
1090277
CPU_TS *p_ts,

Anchor
1090278
1090278
OS_ERR *p_err);

Table Cell (td)
rowspan6

Anchor
1090280
1090280
(3)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)
Table Cell (td)

Anchor
1090017
1090017
 

Table Cell (td)

Anchor
1090019
1090019
OS_OBJ_QTY

Anchor
1090311
1090311
OSMutexPendAbort(

Anchor
1090312
1090312
OS_MUTEX *p_mutex,

Anchor
1090313
1090313
OS_OPT opt,

Anchor
1090314
1090314
OS_ERR *p_err);

Table Cell (td)

Anchor
1090021
1090021
 

Table Row (tr)
Table Cell (td)
rowspan4

Anchor
1090053
1090053
INT8U

Anchor
1090059
1090059
OSMutexPost(

Anchor
1090065
1090065
OS_EVENT *pevent);

Table Cell (td)
rowspan4

Anchor
1090073
1090073
void

Anchor
1090354
1090354
OSMutexPost(

Anchor
1090355
1090355
OS_MUTEX *p_mutex,

Anchor
1090356
1090356
OS_OPT opt,

Anchor
1090346
1090346
OS_ERR *p_err);

Table Cell (td)
rowspan4

Anchor
1090057
1090057
 

Table Row (tr)

Table Row (tr)

Table Row (tr)

Table Row (tr)
Table Cell (td)
rowspan4

Anchor
1090107
1090107
INT8U

Anchor
1090113
1090113
OSMutexQuery(

Anchor
1090119
1090119
OS_EVENT *pevent,

Anchor
1090125
1090125
OS_MUTEX_DATA *p_mutex_data);

Table Cell (td)
rowspan4

Anchor
1090109
1090109
 

Table Cell (td)
rowspan4

Anchor
1090111
1090111
(4)

Table Row (tr)

Table Row (tr)

Table Row (tr)

Anchor
1160495
1160495
 

    1. Anchor
      1080084
      1080084
      Mutual Exclusion Semaphore Management API
      1. Anchor
        1113162
        1113162
        In µC/OS-III, there is no “accept” API, since this feature is built into the OSMutexPend() by specifying the OS_OPT_PEND_NON_BLOCKING option.
      2. Anchor
        1113163
        1113163
        In µC/OS-II, OSMutexCreate() returns the address of an OS_EVENT, which is used as the “handle” to the message mailbox. In µC/OS-III, the application must allocate storage for an OS_MUTEX, which serves the same purpose as the OS_EVENT. The benefit in µC/OS-III is that it is not necessary to predetermine the number of mutual-exclusion semaphores at compile time.
      3. Anchor
        1080087
        1080087
        µC/OS-III returns additional information when a mutex is released. The releaser takes a snapshot of the current time stamp and stores it in the OS_MUTEX. The new owner of the mutex therefore knows when the mutex was released.
      4. Anchor
        1080088
        1080088
        µC/OS-III does not provide query services as they were rarely used.