[dpdk-dev] [PATCH v4] eal: add generic thread-local-storage functions
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Wed Dec 23 02:18:01 CET 2020
> [...]
> +int
> +rte_thread_tls_set_value(rte_tls_key key, const void *value)
> +{
> + int err;
> +
> + if (!key) {
> + RTE_LOG(DEBUG, EAL, "invalid tls key passed to function.\n");
> + return -1;
> + }
> + err = pthread_setspecific(key->thread_index, value);
> + if (err) {
> + RTE_LOG(DEBUG, EAL, "pthread_setspecific failed: %s\n",
> + strerror(err));
> + free(key);
Why free(key) here? Probably a typo.
> [...]
> +__rte_experimental
> +int
> +rte_thread_tls_create_key(rte_tls_key *key, void (*destructor)(void *));
> +
> +/**
> + * Function to delete a TLS data key visible to all threads in the process
> + * rte_tls_key is the opaque pointer allocated by rte_thread_tls_create_key.
> + *
> + * @param key
> + * The rte_tls_key will cantain the allocated key
cantain -> contain
> diff --git a/lib/librte_eal/windows/meson.build b/lib/librte_eal/windows/meson.build
> index 3b2faf29eb..1f1398dfe9 100644
> --- a/lib/librte_eal/windows/meson.build
> +++ b/lib/librte_eal/windows/meson.build
> @@ -21,4 +21,10 @@ sources += files(
> 'getopt.c',
> )
>
> +if (dpdk_conf.has('use_external_pthread'))
Please describe the new option in meson_options.txt.
Maybe drop "external" from the name, what do you think?
More information about the dev
mailing list