Detailed Description
For detailed information about using mutexes please see detailed description of mutexes
Typedef Documentation
Handle to a nano layer semaphore object.
Function Documentation
Mutex function. Allocates a new mutex object.
- Parameters:
-
options | Currently unused. Please set this parameter to 0 (zero). |
name | Name of the new mutex object to create. If the last character in the name is an asteriks (*), the operating system automatically assigns the mutex a unique name (the registry feature must be enabled for this automatism). This parameter can be NULL if the nano layer registry feature is not used and will not be used in future. |
- Returns:
- the pointer to the new mutex object. NULL is returned on error.
- Note:
- NOSCFG_FEATURE_MUTEXES must be defined to 1 to have mutex support compiled in.
Even if the function posMutexDestroy would work also, it is required to call nosMutexDestroy. Only this function removes the mutex from the registry.
Dependent of your configuration, this function can be defined as macro to decrease code size.
- See also:
- nosMutexDestroy, nosMutexLock, nosMutexTryLock, nosMutexUnlock
NANOEXT void POSCALL nosMutexDestroy |
( |
NOSMUTEX_t |
mutex | ) |
|
Mutex function. Frees a no more needed mutex object.
- Parameters:
-
mutex | handle to the mutex object. |
- Note:
- NOSCFG_FEATURE_MUTEXES must be defined to 1 to have mutex support compiled in.
POSCFG_FEATURE_MUTEXDESTROY must be defined to 1 to have this function compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
- See also:
- nosMutexCreate
Mutex function. This function locks a code section so that only one task can execute the code at a time. If an other task already has the lock, the task requesting the lock will be blocked until the mutex is unlocked again. Note that a nosMutexLock appears always in a pair with nosMutexUnlock.
- Parameters:
-
mutex | handle to the mutex object. |
- Returns:
- zero on success.
- Note:
- NOSCFG_FEATURE_MUTEXES must be defined to 1 to have mutex support compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
- See also:
- nosMutexTryLock, nosMutexUnlock, nosMutexCreate
Mutex function. Tries to get the mutex lock. This function does not block when the mutex is not available, instead it returns a value showing that the mutex could not be locked.
- Parameters:
-
mutex | handle to the mutex object. |
- Returns:
- zero when the mutex lock could be set. Otherwise, when the mutex lock is yet helt by an other task, the function returns 1. A negative value is returned on error.
- Note:
- NOSCFG_FEATURE_MUTEXES must be defined to 1 to have mutex support compiled in.
POSCFG_FEATURE_MUTEXTRYLOCK must be defined to 1 to have this function compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
- See also:
- nosMutexLock, nosMutexUnlock, nosMutexCreate
Mutex function. This function unlocks a section of code so that other tasks are able to execute it.
- Parameters:
-
mutex | handle to the mutex object. |
- Returns:
- zero on success.
- Note:
- NOSCFG_FEATURE_MUTEXES must be defined to 1 to have mutex support compiled in.
Dependent of your configuration, this function can be defined as macro to decrease code size.
- See also:
- nosMutexLock, nosMutexTryLock, nosMutexCreate