diff mbox

[API-NEXT,PATCHv2] example: generator: add missing instance set

Message ID 1458738585-12123-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit 5492b8859d966e84bd4e62496ecb87b8a602dd4a
Headers show

Commit Message

Maxim Uvarov March 23, 2016, 1:09 p.m. UTC
Patch: api: init: add instance handle
adds instance id, but for generator one branch of threads start
is missing which lead to failure of odp_init_global(). Add missing
instance id and initial missing structure initialization to zero.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 example/generator/odp_generator.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Anders Roxell March 23, 2016, 3:14 p.m. UTC | #1
On 23 March 2016 at 14:09, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
> Patch: api: init: add instance handle
> adds instance id, but for generator one branch of threads start
> is missing which lead to failure of odp_init_global(). Add missing
> instance id and initial missing structure initialization to zero.

unsure if the changelog reflects what the patch does?

Cheers,
Anders

>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>  example/generator/odp_generator.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
> index 8f69c9c..4bfbc68 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -738,6 +738,11 @@ int main(int argc, char *argv[])
>         /* Create and init worker threads */
>         memset(thread_tbl, 0, sizeof(thread_tbl));
>
> +       /* Init threads params */
> +       memset(&thr_params, 0, sizeof(thr_params));
> +       thr_params.thr_type = ODP_THREAD_WORKER;
> +       thr_params.instance = instance;
> +
>         if (args->appl.mode == APPL_MODE_PING) {
>                 odp_cpumask_t cpu_mask;
>                 odp_queue_t tq;
> @@ -762,11 +767,8 @@ int main(int argc, char *argv[])
>                         abort();
>                 args->thread[1].mode = args->appl.mode;
>
> -               memset(&thr_params, 0, sizeof(thr_params));
>                 thr_params.start    = gen_recv_thread;
>                 thr_params.arg      = &args->thread[1];
> -               thr_params.thr_type = ODP_THREAD_WORKER;
> -               thr_params.instance = instance;
>
>                 odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
>                                           &thr_params);
> --
> 2.7.1.250.gff4ea60
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov March 23, 2016, 3:36 p.m. UTC | #2
Just merged it.

On 03/23/16 18:14, Anders Roxell wrote:
> On 23 March 2016 at 14:09, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>> Patch: api: init: add instance handle
>> adds instance id, but for generator one branch of threads start
>> is missing which lead to failure of odp_init_global(). Add missing
>> instance id and initial missing structure initialization to zero.
> unsure if the changelog reflects what the patch does?
>
> Cheers,
> Anders

Add missing instance id and initial missing structure initialization to zero.

Maxim.

>
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>> ---
>>   example/generator/odp_generator.c | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
>> index 8f69c9c..4bfbc68 100644
>> --- a/example/generator/odp_generator.c
>> +++ b/example/generator/odp_generator.c
>> @@ -738,6 +738,11 @@ int main(int argc, char *argv[])
>>          /* Create and init worker threads */
>>          memset(thread_tbl, 0, sizeof(thread_tbl));
>>
>> +       /* Init threads params */
>> +       memset(&thr_params, 0, sizeof(thr_params));
>> +       thr_params.thr_type = ODP_THREAD_WORKER;
>> +       thr_params.instance = instance;
>> +
>>          if (args->appl.mode == APPL_MODE_PING) {
>>                  odp_cpumask_t cpu_mask;
>>                  odp_queue_t tq;
>> @@ -762,11 +767,8 @@ int main(int argc, char *argv[])
>>                          abort();
>>                  args->thread[1].mode = args->appl.mode;
>>
>> -               memset(&thr_params, 0, sizeof(thr_params));
>>                  thr_params.start    = gen_recv_thread;
>>                  thr_params.arg      = &args->thread[1];
>> -               thr_params.thr_type = ODP_THREAD_WORKER;
>> -               thr_params.instance = instance;
>>
>>                  odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
>>                                            &thr_params);
>> --
>> 2.7.1.250.gff4ea60
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 8f69c9c..4bfbc68 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -738,6 +738,11 @@  int main(int argc, char *argv[])
 	/* Create and init worker threads */
 	memset(thread_tbl, 0, sizeof(thread_tbl));
 
+	/* Init threads params */
+	memset(&thr_params, 0, sizeof(thr_params));
+	thr_params.thr_type = ODP_THREAD_WORKER;
+	thr_params.instance = instance;
+
 	if (args->appl.mode == APPL_MODE_PING) {
 		odp_cpumask_t cpu_mask;
 		odp_queue_t tq;
@@ -762,11 +767,8 @@  int main(int argc, char *argv[])
 			abort();
 		args->thread[1].mode = args->appl.mode;
 
-		memset(&thr_params, 0, sizeof(thr_params));
 		thr_params.start    = gen_recv_thread;
 		thr_params.arg      = &args->thread[1];
-		thr_params.thr_type = ODP_THREAD_WORKER;
-		thr_params.instance = instance;
 
 		odph_linux_pthread_create(&thread_tbl[1], &cpu_mask,
 					  &thr_params);