zephyr/include/posix/pthread_key.h
Peter Bigot ca6e3dcdc4 include/posix: rearrange for standard use of extern "C"
Consistently place C++ use of extern "C" after all include directives,
within the negative branch of _ASMLANGUAGE if used.

Background from issue #17997:

Declarations that use C linkage should be placed within extern "C"
so the language linkage is correct when the header is included by
a C++ compiler.

Similarly #include directives should be outside the extern "C" to
ensure the language-specific default linkage is applied to any
declarations provided by the included header.

See: https://en.cppreference.com/w/cpp/language/language_linkage
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-08-13 18:00:31 +02:00

53 lines
1.0 KiB
C

/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_POSIX_PTHREAD_KEY_H_
#define ZEPHYR_INCLUDE_POSIX_PTHREAD_KEY_H_
#ifdef CONFIG_PTHREAD_IPC
#include <sys/slist.h>
#include <zephyr/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef u32_t pthread_once_t;
/* pthread_key */
typedef void *pthread_key_t;
typedef struct pthread_key_obj {
/* List of pthread_key_data objects that contain thread
* specific data for the key
*/
sys_slist_t key_data_l;
/* Optional destructor that is passed to pthread_key_create() */
void (*destructor)(void *);
} pthread_key_obj;
typedef struct pthread_thread_data {
sys_snode_t node;
/* Key and thread specific data passed to pthread_setspecific() */
pthread_key_obj *key;
void *spec_data;
} pthread_thread_data;
typedef struct pthread_key_data {
sys_snode_t node;
pthread_thread_data thread_data;
} pthread_key_data;
#endif /* CONFIG_PTHREAD_IPC */
#ifdef __cplusplus
}
#endif
#endif /* ZEPHYR_INCLUDE_POSIX_PTHREAD_KEY_H_*/