Skip to content

Commit

Permalink
helper: linux: deprecate thread create and join functions
Browse files Browse the repository at this point in the history
Deprecate unused odph_linux_pthread_create() and odph_linux_pthread_join()
functions which have been replaced by generic odph_thread_create() and
odph_thread_join() functions.

Signed-off-by: Matias Elo <[email protected]>
  • Loading branch information
MatiasElo committed Nov 22, 2024
1 parent db0524e commit 72dfb14
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
12 changes: 8 additions & 4 deletions helper/include/odp/helper/linux/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef ODPH_LINUX_PTHREAD_H_
#define ODPH_LINUX_PTHREAD_H_

#include <odp/helper/deprecated.h>
#include <odp/helper/threads.h>
#include <odp_api.h>

Expand All @@ -39,10 +40,12 @@ extern "C" {
* @param thr_params Linux helper thread parameters
*
* @return Number of threads created
*
* @deprecated Use odph_thread_create() instead.
*/
int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl,
const odp_cpumask_t *mask,
const odph_linux_thr_params_t *thr_params);
int ODPH_DEPRECATE(odph_linux_pthread_create)(odph_linux_pthread_t *pthread_tbl,
const odp_cpumask_t *mask,
const odph_linux_thr_params_t *thr_params);

/**
* Waits pthreads to exit
Expand All @@ -52,8 +55,9 @@ int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl,
* @param thread_tbl Thread table
* @param num Number of threads to create
*
* @deprecated Use odph_thread_join() instead.
*/
void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num);
void ODPH_DEPRECATE(odph_linux_pthread_join)(odph_linux_pthread_t *thread_tbl, int num);

/**
* @}
Expand Down
9 changes: 5 additions & 4 deletions helper/linux/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <odp_api.h>
#include <odp/helper/debug.h>
#include <odp/helper/deprecated.h>
#include <odp/helper/linux/pthread.h>
#include <odp/helper/linux/process.h>

Expand All @@ -41,9 +42,9 @@ static void *_odph_run_start_routine(void *arg)
return ret_ptr;
}

int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl,
const odp_cpumask_t *mask,
const odph_linux_thr_params_t *thr_params)
int ODPH_DEPRECATE(odph_linux_pthread_create)(odph_linux_pthread_t *pthread_tbl,
const odp_cpumask_t *mask,
const odph_linux_thr_params_t *thr_params)
{
int i;
int num;
Expand Down Expand Up @@ -98,7 +99,7 @@ int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl,
return i;
}

void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num)
void ODPH_DEPRECATE(odph_linux_pthread_join)(odph_linux_pthread_t *thread_tbl, int num)
{
int i;
int ret;
Expand Down
4 changes: 2 additions & 2 deletions helper/test/linux/pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
thr_params.thr_type = ODP_THREAD_WORKER;
thr_params.instance = instance;

odph_linux_pthread_create(&thread_tbl[0], &cpu_mask, &thr_params);
odph_linux_pthread_join(thread_tbl, num_workers);
ODPH_DEPRECATE(odph_linux_pthread_create)(&thread_tbl[0], &cpu_mask, &thr_params);
ODPH_DEPRECATE(odph_linux_pthread_join)(thread_tbl, num_workers);

if (odp_term_local()) {
ODPH_ERR("Error: ODP local term failed.\n");
Expand Down

0 comments on commit 72dfb14

Please sign in to comment.