[dpdk-dev] [PATCH v4] eal: add generic thread-local-storage functions

Tal Shnaiderman talshn at nvidia.com
Wed Dec 23 12:44:31 CET 2020


> Subject: Re: [PATCH v4] eal: add generic thread-local-storage functions
> 
> External email: Use caution opening links or attachments
> 
> 
> > [...]
> > +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?

How about use_windows_pthread to be clear that it's unrelated to UNIX pthreads?


More information about the dev mailing list