On 11/25/2014 12:05 AM, Shmulik Ladkani wrote:
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.
Fix by passing '&thread_tbl[i]' instead.
Signed-off-by: Shmulik Ladkani <[email protected]>
---
example/ipsec/odp_ipsec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index ec115fc39e..40b34d09c7 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1314,7 +1314,7 @@ main(int argc, char *argv[])
* 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,
+ odph_linux_pthread_create(&thread_tbl[i], 1, core, pktio_thread,
NULL);
}
Comment bellow was copy-pasted to ipsec example by mistake. Argument to
threads not provided at all.
More clear fix will be change:
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[i], 1, core,
pktio_thread,
NULL);
}
To:
odph_linux_pthread_create(thread_tbl, num_workers,
first_core, pktio_thread,
NULL);
Thanks,
Maxim.
_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp