example: packet: add odp_term_global

Message ID 1459179360-12309-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov March 28, 2016, 3:36 p.m.
Add odp_term_global and comment that it will never
be called.
https://bugs.linaro.org/show_bug.cgi?id=1706

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 example/packet/odp_pktio.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Maxim Uvarov April 1, 2016, 3:53 p.m. | #1
ping. Any feedback is valuable.

Maxim.

On 03/28/16 18:36, Maxim Uvarov wrote:
> Add odp_term_global and comment that it will never
> be called.
> https://bugs.linaro.org/show_bug.cgi?id=1706
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
> ---
>   example/packet/odp_pktio.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
> index dd3e8e3..3e0fdf0 100644
> --- a/example/packet/odp_pktio.c
> +++ b/example/packet/odp_pktio.c
> @@ -438,11 +438,18 @@ int main(int argc, char *argv[])
>   	/* Master thread waits for other threads to exit */
>   	odph_linux_pthread_join(thread_tbl, num_workers);
>   
> +	/* Application wait for crtl+c to be interrupted,
> +	* code bellow is never reachable. Keep it in current
> +	* example to  emphasize that final termination has to
> +	* be with odp_term_global().
> +	*/
> +
>   	free(args->appl.if_names);
>   	free(args->appl.if_str);
>   	free(args);
> -	printf("Exit\n\n");
>   
> +	odp_term_local();
> +	odp_term_global();
>   	return 0;
>   }
>
Mike Holmes April 1, 2016, 4 p.m. | #2
How does this example terminate in a "make check" situation ?

On 1 April 2016 at 11:53, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> ping. Any feedback is valuable.

>

> Maxim.

>

>

> On 03/28/16 18:36, Maxim Uvarov wrote:

>

>> Add odp_term_global and comment that it will never

>> be called.

>> https://bugs.linaro.org/show_bug.cgi?id=1706

>>

>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

>> ---

>>   example/packet/odp_pktio.c | 9 ++++++++-

>>   1 file changed, 8 insertions(+), 1 deletion(-)

>>

>> diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c

>> index dd3e8e3..3e0fdf0 100644

>> --- a/example/packet/odp_pktio.c

>> +++ b/example/packet/odp_pktio.c

>> @@ -438,11 +438,18 @@ int main(int argc, char *argv[])

>>         /* Master thread waits for other threads to exit */

>>         odph_linux_pthread_join(thread_tbl, num_workers);

>>   +     /* Application wait for crtl+c to be interrupted,

>> +       * code bellow is never reachable. Keep it in current

>> +       * example to  emphasize that final termination has to

>> +       * be with odp_term_global().

>> +       */

>> +

>>         free(args->appl.if_names);

>>         free(args->appl.if_str);

>>         free(args);

>> -       printf("Exit\n\n");

>>   +     odp_term_local();

>> +       odp_term_global();

>>         return 0;

>>   }

>>

>>

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>




-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"
Maxim Uvarov April 1, 2016, 4:12 p.m. | #3
On 04/01/16 19:00, Mike Holmes wrote:
> How does this example terminate in a "make check" situation ?

we do not run it in make check

Maxim.

>
> On 1 April 2016 at 11:53, Maxim Uvarov <maxim.uvarov@linaro.org 
> <mailto:maxim.uvarov@linaro.org>> wrote:
>
>     ping. Any feedback is valuable.
>
>     Maxim.
>
>
>     On 03/28/16 18:36, Maxim Uvarov wrote:
>
>         Add odp_term_global and comment that it will never
>         be called.
>         https://bugs.linaro.org/show_bug.cgi?id=1706
>
>         Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org
>         <mailto:maxim.uvarov@linaro.org>>
>         ---
>           example/packet/odp_pktio.c | 9 ++++++++-
>           1 file changed, 8 insertions(+), 1 deletion(-)
>
>         diff --git a/example/packet/odp_pktio.c
>         b/example/packet/odp_pktio.c
>         index dd3e8e3..3e0fdf0 100644
>         --- a/example/packet/odp_pktio.c
>         +++ b/example/packet/odp_pktio.c
>         @@ -438,11 +438,18 @@ int main(int argc, char *argv[])
>                 /* Master thread waits for other threads to exit */
>                 odph_linux_pthread_join(thread_tbl, num_workers);
>           +     /* Application wait for crtl+c to be interrupted,
>         +       * code bellow is never reachable. Keep it in current
>         +       * example to  emphasize that final termination has to
>         +       * be with odp_term_global().
>         +       */
>         +
>                 free(args->appl.if_names);
>                 free(args->appl.if_str);
>                 free(args);
>         -       printf("Exit\n\n");
>           +     odp_term_local();
>         +       odp_term_global();
>                 return 0;
>           }
>
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> -- 
> Mike Holmes
> Technical Manager - Linaro Networking Group
> Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM SoCs
> "Work should be fun and collaborative, the rest follows"
>
Mike Holmes April 1, 2016, 4:26 p.m. | #4
On 1 April 2016 at 12:12, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 04/01/16 19:00, Mike Holmes wrote:

>

>> How does this example terminate in a "make check" situation ?

>>

>

> we do not run it in make check

>


We should reinforce that it is unusual for our examples to run indefinitely
and fix this fully now, if we start to accept that things run forever they
can never be added to make check.


>

> Maxim.

>

>

>> On 1 April 2016 at 11:53, Maxim Uvarov <maxim.uvarov@linaro.org <mailto:

>> maxim.uvarov@linaro.org>> wrote:

>>

>>     ping. Any feedback is valuable.

>>

>>     Maxim.

>>

>>

>>     On 03/28/16 18:36, Maxim Uvarov wrote:

>>

>>         Add odp_term_global and comment that it will never

>>         be called.

>>         https://bugs.linaro.org/show_bug.cgi?id=1706

>>

>>         Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org

>>         <mailto:maxim.uvarov@linaro.org>>

>>

>>         ---

>>           example/packet/odp_pktio.c | 9 ++++++++-

>>           1 file changed, 8 insertions(+), 1 deletion(-)

>>

>>         diff --git a/example/packet/odp_pktio.c

>>         b/example/packet/odp_pktio.c

>>         index dd3e8e3..3e0fdf0 100644

>>         --- a/example/packet/odp_pktio.c

>>         +++ b/example/packet/odp_pktio.c

>>         @@ -438,11 +438,18 @@ int main(int argc, char *argv[])

>>                 /* Master thread waits for other threads to exit */

>>                 odph_linux_pthread_join(thread_tbl, num_workers);

>>           +     /* Application wait for crtl+c to be interrupted,

>>         +       * code bellow is never reachable. Keep it in current

>>         +       * example to  emphasize that final termination has to

>>         +       * be with odp_term_global().

>>         +       */

>>         +

>>                 free(args->appl.if_names);

>>                 free(args->appl.if_str);

>>                 free(args);

>>         -       printf("Exit\n\n");

>>           +     odp_term_local();

>>         +       odp_term_global();

>>                 return 0;

>>           }

>>

>>

>>     _______________________________________________

>>     lng-odp mailing list

>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>

>>     https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>>

>>

>>

>> --

>> Mike Holmes

>> Technical Manager - Linaro Networking Group

>> Linaro.org <http://www.linaro.org/>***│ *Open source software for ARM

>> SoCs

>> "Work should be fun and collaborative, the rest follows"

>>

>>

>



-- 
Mike Holmes
Technical Manager - Linaro Networking Group
Linaro.org <http://www.linaro.org/> *│ *Open source software for ARM SoCs
"Work should be fun and collaborative, the rest follows"

Patch

diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index dd3e8e3..3e0fdf0 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -438,11 +438,18 @@  int main(int argc, char *argv[])
 	/* Master thread waits for other threads to exit */
 	odph_linux_pthread_join(thread_tbl, num_workers);
 
+	/* Application wait for crtl+c to be interrupted,
+	* code bellow is never reachable. Keep it in current
+	* example to  emphasize that final termination has to
+	* be with odp_term_global().
+	*/
+
 	free(args->appl.if_names);
 	free(args->appl.if_str);
 	free(args);
-	printf("Exit\n\n");
 
+	odp_term_local();
+	odp_term_global();
 	return 0;
 }