diff mbox

[1/3] example: l2fwd_simple: add termination path

Message ID 1469675371-20274-1-git-send-email-forrest.shi@linaro.org
State New
Headers show

Commit Message

Forrest Shi July 28, 2016, 3:09 a.m. UTC
From: Xuelin Shi <forrest.shi@linaro.org>


release resouces on exit.

Signed-off-by: Xuelin Shi <forrest.shi@linaro.org>

---
 example/l2fwd_simple/odp_l2fwd_simple.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

-- 
2.1.0.27.g96db324

Comments

Maxim Uvarov July 28, 2016, 6:31 a.m. UTC | #1
On 07/28/16 06:09, forrest.shi@linaro.org wrote:
> From: Xuelin Shi <forrest.shi@linaro.org>

>

> release resouces on exit.

>

> Signed-off-by: Xuelin Shi <forrest.shi@linaro.org>

> ---

>   example/l2fwd_simple/odp_l2fwd_simple.c | 15 +++++++++++++++

>   1 file changed, 15 insertions(+)

>

> diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c

> index 8a14e7d..b351b03 100644

> --- a/example/l2fwd_simple/odp_l2fwd_simple.c

> +++ b/example/l2fwd_simple/odp_l2fwd_simple.c

> @@ -195,5 +195,20 @@ int main(int argc, char **argv)

>   	odph_odpthreads_create(thd, &cpumask, &thr_params);

>   	odph_odpthreads_join(thd);

>   

> +	if (odp_pool_destroy(pool)) {

> +		printf("Error: pool destroy\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	if (odp_term_local()) {

> +		printf("Error: term local\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	if (odp_term_global(instance)) {

> +		printf("Error: term global\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

>   	return 0;

>   }

you just added code that is not called due to in current example all 
threads will spin forever in join().
You also need modify logic to make that functions called under 'make check'

Maxim.
Maxim Uvarov Aug. 18, 2016, 10:39 a.m. UTC | #2
Hello Forest, are you planning to update that patches?

Maxim.

On 07/28/16 06:09, forrest.shi@linaro.org wrote:
> From: Xuelin Shi <forrest.shi@linaro.org>

>

> release resouces on exit.

>

> Signed-off-by: Xuelin Shi <forrest.shi@linaro.org>

> ---

>   example/l2fwd_simple/odp_l2fwd_simple.c | 15 +++++++++++++++

>   1 file changed, 15 insertions(+)

>

> diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c

> index 8a14e7d..b351b03 100644

> --- a/example/l2fwd_simple/odp_l2fwd_simple.c

> +++ b/example/l2fwd_simple/odp_l2fwd_simple.c

> @@ -195,5 +195,20 @@ int main(int argc, char **argv)

>   	odph_odpthreads_create(thd, &cpumask, &thr_params);

>   	odph_odpthreads_join(thd);

>   

> +	if (odp_pool_destroy(pool)) {

> +		printf("Error: pool destroy\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	if (odp_term_local()) {

> +		printf("Error: term local\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

> +	if (odp_term_global(instance)) {

> +		printf("Error: term global\n");

> +		exit(EXIT_FAILURE);

> +	}

> +

>   	return 0;

>   }
Forrest Shi Aug. 22, 2016, 7:48 a.m. UTC | #3
Hi Maxim,

Sorry for late response.  I was outing on Friday/Weekend.

I'm OK with your updates.

thanks,
Forrest

在 8/18/2016 6:39 PM, Maxim Uvarov 写道:
> Hello Forest, are you planning to update that patches?

>

> Maxim.

>

> On 07/28/16 06:09, forrest.shi@linaro.org wrote:

>> From: Xuelin Shi <forrest.shi@linaro.org>

>>

>> release resouces on exit.

>>

>> Signed-off-by: Xuelin Shi <forrest.shi@linaro.org>

>> ---

>>   example/l2fwd_simple/odp_l2fwd_simple.c | 15 +++++++++++++++

>>   1 file changed, 15 insertions(+)

>>

>> diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c 

>> b/example/l2fwd_simple/odp_l2fwd_simple.c

>> index 8a14e7d..b351b03 100644

>> --- a/example/l2fwd_simple/odp_l2fwd_simple.c

>> +++ b/example/l2fwd_simple/odp_l2fwd_simple.c

>> @@ -195,5 +195,20 @@ int main(int argc, char **argv)

>>       odph_odpthreads_create(thd, &cpumask, &thr_params);

>>       odph_odpthreads_join(thd);

>>   +    if (odp_pool_destroy(pool)) {

>> +        printf("Error: pool destroy\n");

>> +        exit(EXIT_FAILURE);

>> +    }

>> +

>> +    if (odp_term_local()) {

>> +        printf("Error: term local\n");

>> +        exit(EXIT_FAILURE);

>> +    }

>> +

>> +    if (odp_term_global(instance)) {

>> +        printf("Error: term global\n");

>> +        exit(EXIT_FAILURE);

>> +    }

>> +

>>       return 0;

>>   }

>
Maxim Uvarov Aug. 22, 2016, 8:51 a.m. UTC | #4
thanks.

On 08/22/16 10:48, forrest.shi wrote:
> Hi Maxim,

>

> Sorry for late response.  I was outing on Friday/Weekend.

>

> I'm OK with your updates.

>

> thanks,

> Forrest

>

> 在 8/18/2016 6:39 PM, Maxim Uvarov 写道:

>> Hello Forest, are you planning to update that patches?

>>

>> Maxim.

>>

>> On 07/28/16 06:09, forrest.shi@linaro.org wrote:

>>> From: Xuelin Shi <forrest.shi@linaro.org>

>>>

>>> release resouces on exit.

>>>

>>> Signed-off-by: Xuelin Shi <forrest.shi@linaro.org>

>>> ---

>>>   example/l2fwd_simple/odp_l2fwd_simple.c | 15 +++++++++++++++

>>>   1 file changed, 15 insertions(+)

>>>

>>> diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c 

>>> b/example/l2fwd_simple/odp_l2fwd_simple.c

>>> index 8a14e7d..b351b03 100644

>>> --- a/example/l2fwd_simple/odp_l2fwd_simple.c

>>> +++ b/example/l2fwd_simple/odp_l2fwd_simple.c

>>> @@ -195,5 +195,20 @@ int main(int argc, char **argv)

>>>       odph_odpthreads_create(thd, &cpumask, &thr_params);

>>>       odph_odpthreads_join(thd);

>>>   +    if (odp_pool_destroy(pool)) {

>>> +        printf("Error: pool destroy\n");

>>> +        exit(EXIT_FAILURE);

>>> +    }

>>> +

>>> +    if (odp_term_local()) {

>>> +        printf("Error: term local\n");

>>> +        exit(EXIT_FAILURE);

>>> +    }

>>> +

>>> +    if (odp_term_global(instance)) {

>>> +        printf("Error: term global\n");

>>> +        exit(EXIT_FAILURE);

>>> +    }

>>> +

>>>       return 0;

>>>   }

>>

>
diff mbox

Patch

diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c
index 8a14e7d..b351b03 100644
--- a/example/l2fwd_simple/odp_l2fwd_simple.c
+++ b/example/l2fwd_simple/odp_l2fwd_simple.c
@@ -195,5 +195,20 @@  int main(int argc, char **argv)
 	odph_odpthreads_create(thd, &cpumask, &thr_params);
 	odph_odpthreads_join(thd);
 
+	if (odp_pool_destroy(pool)) {
+		printf("Error: pool destroy\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_term_local()) {
+		printf("Error: term local\n");
+		exit(EXIT_FAILURE);
+	}
+
+	if (odp_term_global(instance)) {
+		printf("Error: term global\n");
+		exit(EXIT_FAILURE);
+	}
+
 	return 0;
 }