Merge "Document pthread_key_create(3), pthread_key_delete(3), and PTHREAD_KEYS_MAX." into main am: ed21ffc70a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3046887 Change-Id: I04e2c0670f3c523949c8d7de39e147ea6caf2d16 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
7f1b24cbbf
2 changed files with 30 additions and 2 deletions
|
@ -148,9 +148,15 @@
|
|||
|
||||
/* >= _POSIX_THREAD_DESTRUCTOR_ITERATIONS */
|
||||
#define PTHREAD_DESTRUCTOR_ITERATIONS 4
|
||||
/* >= _POSIX_THREAD_KEYS_MAX */
|
||||
|
||||
/**
|
||||
* The number of calls to pthread_key_create() without intervening calls to
|
||||
* pthread_key_delete() that are guaranteed to succeed. See pthread_key_create()
|
||||
* for more details and ways to avoid hitting this limit.
|
||||
*/
|
||||
#define PTHREAD_KEYS_MAX 128
|
||||
/* bionic has no specific limit */
|
||||
|
||||
/** bionic has no specific limit on the number of threads. */
|
||||
#undef PTHREAD_THREADS_MAX
|
||||
|
||||
#endif /* !_LIMITS_H_ */
|
||||
|
|
|
@ -174,7 +174,29 @@ pid_t pthread_gettid_np(pthread_t __pthread);
|
|||
|
||||
int pthread_join(pthread_t __pthread, void* _Nullable * _Nullable __return_value_ptr);
|
||||
|
||||
/**
|
||||
* [pthread_key_create(3)](https://man7.org/linux/man-pages/man3/pthread_key_create.3p.html)
|
||||
* creates a key for thread-specific data.
|
||||
*
|
||||
* There is a limit of `PTHREAD_KEYS_MAX` keys per process, but most callers
|
||||
* should just use the C or C++ `thread_local` storage specifier anyway. When
|
||||
* targeting new enough OS versions, the compiler will automatically use
|
||||
* ELF TLS; when targeting old OS versions the emutls implementation will
|
||||
* multiplex pthread keys behind the scenes, using one per library rather than
|
||||
* one per thread-local variable. If you are implementing the runtime for a
|
||||
* different language, you should consider similar implementation choices and
|
||||
* avoid a direct one-to-one mapping from thread locals to pthread keys.
|
||||
*
|
||||
* Returns 0 on success and returns an error number on failure.
|
||||
*/
|
||||
int pthread_key_create(pthread_key_t* _Nonnull __key_ptr, void (* _Nullable __key_destructor)(void* _Nullable));
|
||||
|
||||
/**
|
||||
* [pthread_key_delete(3)](https://man7.org/linux/man-pages/man3/pthread_key_delete.3p.html)
|
||||
* deletes a key for thread-specific data.
|
||||
*
|
||||
* Returns 0 on success and returns an error number on failure.
|
||||
*/
|
||||
int pthread_key_delete(pthread_key_t __key);
|
||||
|
||||
int pthread_mutexattr_destroy(pthread_mutexattr_t* _Nonnull __attr);
|
||||
|
|
Loading…
Reference in a new issue