Mutexes
|
mutCreate ( ) |
Name: |
mutCreate ( ) - creates a mutex |
Synopsis: |
MUT_HANDLE mutCreate
(
void
)
|
Description: |
Creates a mutex. Mutexes in this system do not inherit priorities.
Mutexes are similar to binary semaphores, except that the thread that
allocates the mutex must also release the mutex. Mutexes are created
in an unallocated state. |
Include: |
mutex.h |
Returns: |
The MUT_HANDLE of the newly created mutex. Note that this
function will not return if the mutex cannot be created, instead the
system will halt (during development) or reboot (if in the field)
so there are no illegal values that can be returned. |
See Also: |
mutDestroy, mutTake,
mutGive |
|
mutDestroy ( ) |
Name: |
mutDestroy ( ) - destroys a mutex |
Synopsis: |
void mutDestroy
(
MUT_HANDLE mutHandle /* mutex to delete */
)
|
Description: |
Deletes a mutex. Be careful not to delete a mutex from the system
that is currently allocated by a thread since this is undefined behavior.
|
Include: |
mutex.h |
Returns: |
nothing |
See Also: |
mutCreate |
|
mutTake ( ) |
Name: |
mutTake ( ) - takes a mutex |
Synopsis: |
void mutTake
(
MUT_HANDLE mutHandle /* mutex to take */
)
|
Description: |
Requests ownership of a mutex. If the mutex is not immediately available,
the calling thread is blocked until the mutex becomes available.
Note that it is undefined behavior to call this function multiple
times without calling mutGive. In other words,
nesting this call is not supported.
|
Include: |
mutex.h |
Returns: |
nothing |
See Also: |
mutGive |
|
mutGive ( ) |
Name: |
mutGive ( ) - releases a taken mutex |
Synopsis: |
void mutGive
(
MUT_HANDLE mutHandle /* mutex to give */
)
|
Description: |
Releases ownership of a mutex. Mutexes can only be released by the
thread that took the mutex. Releasing a mutex that has been taken
by another thread is undefined behavior. This function is paired with
mutTake. |
Include: |
mutex.h |
Returns: |
nothing |
See Also: |
mutTake |
|