FreeRTOS:
POSIX
|
Return to main page ↑ |
Implementation of mutex functions in pthread.h. More...
#include <stddef.h>
#include <string.h>
#include "FreeRTOS_POSIX.h"
#include "FreeRTOS_POSIX/errno.h"
#include "FreeRTOS_POSIX/pthread.h"
#include "FreeRTOS_POSIX/utils.h"
Functions | |
static void | prvInitializeStaticMutex (pthread_mutex_internal_t *pxMutex) |
Initialize a PTHREAD_MUTEX_INITIALIZER mutex. More... | |
int | pthread_mutex_destroy (pthread_mutex_t *mutex) |
Destroy a mutex. More... | |
int | pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) |
Initialize a mutex. More... | |
int | pthread_mutex_lock (pthread_mutex_t *mutex) |
Lock a mutex. More... | |
int | pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime) |
Lock a mutex with timeout. More... | |
int | pthread_mutex_trylock (pthread_mutex_t *mutex) |
Attempt to lock a mutex. Fail immediately if mutex is already locked. More... | |
int | pthread_mutex_unlock (pthread_mutex_t *mutex) |
Unlock a mutex. More... | |
int | pthread_mutexattr_destroy (pthread_mutexattr_t *attr) |
Destroy the mutex attributes object. More... | |
int | pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *type) |
Get the mutex type attribute. More... | |
int | pthread_mutexattr_init (pthread_mutexattr_t *attr) |
Initialize the mutex attributes object. More... | |
int | pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type) |
Set the mutex type attribute. More... | |
Variables | |
static const pthread_mutexattr_internal_t | xDefaultMutexAttributes |
Default pthread_mutexattr_t. More... | |
Implementation of mutex functions in pthread.h.
|
static |
Initialize a PTHREAD_MUTEX_INITIALIZER mutex.
PTHREAD_MUTEX_INITIALIZER sets a flag for a mutex to be initialized later. This function performs the initialization.
[in] | pxMutex | The mutex to initialize. |
int pthread_mutex_destroy | ( | pthread_mutex_t * | mutex | ) |
Destroy a mutex.
0 | - Upon successful completion. |
int pthread_mutex_init | ( | pthread_mutex_t * | mutex, |
const pthread_mutexattr_t * | attr | ||
) |
Initialize a mutex.
0 | - Upon successful completion. |
ENOMEM | - Insufficient memory exists to initialize the mutex structure. |
EAGAIN | - Unable to initialize the mutex structure member(s). |
int pthread_mutex_lock | ( | pthread_mutex_t * | mutex | ) |
Lock a mutex.
0 | - Upon successful completion. |
EINVAL | - the abstime parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. |
EDEADLK | - The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread already owns the mutex. |
int pthread_mutex_timedlock | ( | pthread_mutex_t * | mutex, |
const struct timespec * | abstime | ||
) |
Lock a mutex with timeout.
0 | - Upon successful completion. |
EINVAL | - The abstime argument passed in does not refer to an initialized structure OR the abstime parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. |
EDEADLK | - The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread already owns the mutex. |
ETIMEDOUT | - The mutex could not be locked before the specified timeout expired. |
int pthread_mutex_trylock | ( | pthread_mutex_t * | mutex | ) |
Attempt to lock a mutex. Fail immediately if mutex is already locked.
0 | - Upon successful completion. |
EINVAL | - the abstime parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million. |
EDEADLK | - The mutex type is PTHREAD_MUTEX_ERRORCHECK and the current thread already owns the mutex. |
EBUSY | - The mutex could not be acquired because it was already locked. |
int pthread_mutex_unlock | ( | pthread_mutex_t * | mutex | ) |
Unlock a mutex.
0 | - Upon successful completion. |
EPERM | - The mutex type is PTHREAD_MUTEX_ERRORCHECK or PTHREAD_MUTEX_RECURSIVE, and the current thread does not own the mutex. |
int pthread_mutexattr_destroy | ( | pthread_mutexattr_t * | attr | ) |
Destroy the mutex attributes object.
0 | - Upon successful completion. |
int pthread_mutexattr_gettype | ( | const pthread_mutexattr_t * | attr, |
int * | type | ||
) |
Get the mutex type attribute.
0 | - Upon successful completion. |
int pthread_mutexattr_init | ( | pthread_mutexattr_t * | attr | ) |
Initialize the mutex attributes object.
0 | - Upon successful completion. |
int pthread_mutexattr_settype | ( | pthread_mutexattr_t * | attr, |
int | type | ||
) |
Set the mutex type attribute.
0 | - Upon successful completion. |
EINVAL | - The value type is invalid. |
|
static |
Default pthread_mutexattr_t.