aboutsummaryrefslogtreecommitdiff
path: root/helper
diff options
context:
space:
mode:
authorJere Leppänen <jere.leppanen@nokia.com>2021-08-10 15:38:03 +0300
committerPetri Savolainen <petri.savolainen@nokia.com>2021-09-30 11:10:11 +0300
commit11cc264d989d28135cfa6783197fdec39b9c8f61 (patch)
tree8c9264e470157f6e51198fbf7ef63218ea0789f4 /helper
parent0325d7d4aeff78171a893bd73ea6c6474bc83ddf (diff)
helper: threads: add odph_thread_param_init()
Add helper API function to initialize thread parameters. Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com> Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'helper')
-rw-r--r--helper/include/odp/helper/threads.h12
-rw-r--r--helper/threads.c5
2 files changed, 17 insertions, 0 deletions
diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h
index 5cd614eac..fe3118918 100644
--- a/helper/include/odp/helper/threads.h
+++ b/helper/include/odp/helper/threads.h
@@ -179,6 +179,15 @@ typedef struct {
} odph_thread_common_param_t;
/**
+ * Initialize thread params
+ *
+ * Initialize an odph_thread_param_t to its default values for all fields.
+ *
+ * @param[out] param Pointer to parameter structure
+ */
+void odph_thread_param_init(odph_thread_param_t *param);
+
+/**
* Initialize thread common params
*
* Initialize an odph_thread_common_param_t to its default values for all
@@ -207,6 +216,9 @@ void odph_thread_common_param_init(odph_thread_common_param_t *param);
* with a single thread parameter table element by setting 'share_param'
* parameter.
*
+ * Use odph_thread_common_param_init() and odph_thread_param_init() to
+ * initialize parameters with default values.
+ *
* Thread table must be large enough to hold 'num' elements. Also the cpumask
* must contain 'num' CPUs. Threads are pinned to CPUs in order - the first
* thread goes to the smallest CPU number of the mask, etc.
diff --git a/helper/threads.c b/helper/threads.c
index 38c1293c1..d18f08284 100644
--- a/helper/threads.c
+++ b/helper/threads.c
@@ -224,6 +224,11 @@ static int wait_pthread(odph_thread_t *thread)
return 0;
}
+void odph_thread_param_init(odph_thread_param_t *param)
+{
+ memset(param, 0, sizeof(*param));
+}
+
void odph_thread_common_param_init(odph_thread_common_param_t *param)
{
memset(param, 0, sizeof(*param));