mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
included/pthreads, sched/pthreads, and Documetions: Updates after review of last PR.
This commit is contained in:
+23
-18
@@ -1,7 +1,8 @@
|
||||
/********************************************************************************
|
||||
* include/pthread.h
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011-2012, 2015-2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011-2012, 2015-2017, 2019 Gregory Nutt. All
|
||||
* rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -77,23 +78,26 @@
|
||||
*
|
||||
* PTHREAD_MUTEX_NORMAL: This type of mutex does not detect deadlock. A thread
|
||||
* attempting to relock this mutex without first unlocking it will deadlock.
|
||||
* Attempting to unlock a mutex locked by a different thread results in undefined
|
||||
* behavior. Attempting to unlock an unlocked mutex results in undefined behavior.
|
||||
* Attempting to unlock a mutex locked by a different thread results in
|
||||
* undefined behavior. Attempting to unlock an unlocked mutex results in
|
||||
* undefined behavior.
|
||||
* PTHREAD_MUTEX_ERRORCHECK
|
||||
* This type of mutex provides error checking. A thread attempting to relock this
|
||||
* mutex without first unlocking it will return with an error. A thread attempting
|
||||
* to unlock a mutex which another thread has locked will return with an error. A
|
||||
* thread attempting to unlock an unlocked mutex will return with an error.
|
||||
* This type of mutex provides error checking. A thread attempting to relock
|
||||
* this mutex without first unlocking it will return with an error. A thread
|
||||
* attempting to unlock a mutex which another thread has locked will return
|
||||
* with an error. A thread attempting to unlock an unlocked mutex will return
|
||||
* with an error.
|
||||
* PTHREAD_MUTEX_RECURSIVE
|
||||
* A thread attempting to relock this mutex without first unlocking it will succeed
|
||||
* in locking the mutex. The relocking deadlock which can occur with mutexes of type
|
||||
* PTHREAD_MUTEX_NORMAL cannot occur with this type of mutex. Multiple locks of this
|
||||
* mutex require the same number of unlocks to release the mutex before another thread
|
||||
* can acquire the mutex. A thread attempting to unlock a mutex which another thread
|
||||
* has locked will return with an error. A thread attempting to unlock an unlocked
|
||||
* mutex will return with an error.
|
||||
* A thread attempting to relock this mutex without first unlocking it will
|
||||
* succeed in locking the mutex. The relocking deadlock which can occur with
|
||||
* mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with this type of mutex.
|
||||
* Multiple locks of this mutex require the same number of unlocks to release
|
||||
* the mutex before another thread can acquire the mutex. A thread attempting
|
||||
* to unlock a mutex which another thread has locked will return with an error.
|
||||
* A thread attempting to unlock an unlocked mutex will return with an error.
|
||||
* PTHREAD_MUTEX_DEFAULT
|
||||
* An implementation is allowed to map this mutex to one of the other mutex types.
|
||||
* An implementation is allowed to map this mutex to one of the other mutex
|
||||
* types.
|
||||
*/
|
||||
|
||||
#define PTHREAD_MUTEX_NORMAL 0
|
||||
@@ -509,7 +513,7 @@ int pthread_getaffinity_np(pthread_t thread, size_t cpusetsize,
|
||||
/* Thread-specific Data Interfaces */
|
||||
|
||||
int pthread_key_create(FAR pthread_key_t *key,
|
||||
CODE void (*destructor)(FAR void*));
|
||||
CODE void (*destructor)(FAR void *));
|
||||
int pthread_setspecific(pthread_key_t key, FAR const void *value);
|
||||
FAR void *pthread_getspecific(pthread_key_t key);
|
||||
int pthread_key_delete(pthread_key_t key);
|
||||
@@ -540,7 +544,7 @@ int pthread_mutex_init(FAR pthread_mutex_t *mutex,
|
||||
int pthread_mutex_destroy(FAR pthread_mutex_t *mutex);
|
||||
int pthread_mutex_lock(FAR pthread_mutex_t *mutex);
|
||||
int pthread_mutex_timedlock(FAR pthread_mutex_t *mutex,
|
||||
FAR const struct timespec *abs_timeout);
|
||||
FAR const struct timespec *abs_timeout);
|
||||
int pthread_mutex_trylock(FAR pthread_mutex_t *mutex);
|
||||
int pthread_mutex_unlock(FAR pthread_mutex_t *mutex);
|
||||
|
||||
@@ -557,7 +561,8 @@ int pthread_condattr_destroy(FAR pthread_condattr_t *attr);
|
||||
|
||||
/* A thread can create and delete condition variables. */
|
||||
|
||||
int pthread_cond_init(FAR pthread_cond_t *cond, FAR const pthread_condattr_t *attr);
|
||||
int pthread_cond_init(FAR pthread_cond_t *cond,
|
||||
FAR const pthread_condattr_t *attr);
|
||||
int pthread_cond_destroy(FAR pthread_cond_t *cond);
|
||||
|
||||
/* A thread can signal to and broadcast on a condition variable. */
|
||||
|
||||
Reference in New Issue
Block a user