pthread_key.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2018 Intel Corporation
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef ZEPHYR_INCLUDE_POSIX_PTHREAD_KEY_H_
  7. #define ZEPHYR_INCLUDE_POSIX_PTHREAD_KEY_H_
  8. #ifdef CONFIG_PTHREAD_IPC
  9. #include <sys/slist.h>
  10. #include <zephyr/types.h>
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. typedef uint32_t pthread_once_t;
  15. /* pthread_key */
  16. typedef void *pthread_key_t;
  17. typedef struct pthread_key_obj {
  18. /* List of pthread_key_data objects that contain thread
  19. * specific data for the key
  20. */
  21. sys_slist_t key_data_l;
  22. /* Optional destructor that is passed to pthread_key_create() */
  23. void (*destructor)(void *);
  24. } pthread_key_obj;
  25. typedef struct pthread_thread_data {
  26. sys_snode_t node;
  27. /* Key and thread specific data passed to pthread_setspecific() */
  28. pthread_key_obj *key;
  29. void *spec_data;
  30. } pthread_thread_data;
  31. typedef struct pthread_key_data {
  32. sys_snode_t node;
  33. pthread_thread_data thread_data;
  34. } pthread_key_data;
  35. #ifdef __cplusplus
  36. }
  37. #endif
  38. #endif /* CONFIG_PTHREAD_IPC */
  39. #endif /* ZEPHYR_INCLUDE_POSIX_PTHREAD_KEY_H_*/