On Wed, Jun 09, 2021 at 02:04:09AM +0300, Dmitry Kozlyuk wrote: > 2021-06-04 16:44 (UTC-0700), Narcisa Ana Maria Vasile: > [...] > > diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h > > index 5c54cd9d67..1d481b9ad5 100644 > > --- a/lib/eal/include/rte_thread.h > > +++ b/lib/eal/include/rte_thread.h > > +__rte_experimental > > +int rte_thread_create(rte_thread_t *thread_id, > > + const rte_thread_attr_t *thread_attr, > > + void *(*thread_func)(void *), void *args); > > 1. Thread function prototype is used at least in 4 places, > maybe give it a name, like `rte_thread_func`? > > 2. We can't easily support it's `void*` return type on Windows, > because it doesn't fit in DWORD. In `rte_thread_join` below you use `int`. > All `pthread_join` usages in DPDK ignore return value, but I'd rather keep it. > Do you think it's OK to stick to `int`? > Thank you, I agree that we should keep it. I've changed it to unsigned long to fit with Windows's DWORD as well.
> [...] > > +/** > > + * Terminates a thread. > > + * > > + * @param thread_id > > + * The id of the thread to be cancelled. > > + * > > + * @return > > + * On success, return 0. > > + * On failure, return a positive errno-style error number. > > + */ > > +__rte_experimental > > +int rte_thread_cancel(rte_thread_t thread_id); > > What do you think of making this function internal for now? > We don't want applications to rely on this prototype. > To hide it from Doxygen, `/*` comment or #ifndef __DOXYGEN__ can be used. > It is worth noting in commit message > that it's not implemented for Windows and why. > Thank you, I've removed it for now. > > + > > + HANDLE thread_handle = NULL; > > + GROUP_AFFINITY thread_affinity; > > + struct thread_routine_ctx *ctx = NULL; > > + > > + ctx = calloc(1, sizeof(*ctx)); > > Why use `calloc()` for a scalar? ctx is pointer to struct that holds the thread function pointer and its arguments. Did I misunderstand what you meant? >