Per-worker '&thread_tbl[i]' instance should be initialized by 'odph_linux_pthread_create()'.
However, 'thread_tbl' (the array itself) was accidentally passed to 'odph_linux_pthread_create', re-initializing 'thread_tbl[0]' on each iteration. Furthermore, the iteration is not needed as all threads are initialized identically (with a NULL start_routine), as pointed out by Maxim Uvarov. Fix by calling 'odph_linux_pthread_create' and specifying 'num_workers' as the number of threads to initialize. Signed-off-by: Shmulik Ladkani <[email protected]> --- v2: Removed unnecessary iteration initializing one thread at a time example/ipsec/odp_ipsec.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index ec115fc39e..17c6a76894 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1303,20 +1303,8 @@ main(int argc, char *argv[]) /* * Create and init worker threads */ - memset(thread_tbl, 0, sizeof(thread_tbl)); - for (i = 0; i < num_workers; ++i) { - int core; - - core = (first_core + i) % core_count; - - /* - * Create threads one-by-one instead of all-at-once, - * because each thread might get different arguments. - * Calls odp_thread_create(cpu) for each thread - */ - odph_linux_pthread_create(thread_tbl, 1, core, pktio_thread, - NULL); - } + odph_linux_pthread_create(thread_tbl, num_workers, first_core, + pktio_thread, NULL); /* * If there are streams attempt to verify them else -- 1.9.1 _______________________________________________ lng-odp mailing list [email protected] http://lists.linaro.org/mailman/listinfo/lng-odp
