diff mbox

[API-NEXT,PATCHv2] validation: timer: fix delay after loop

Message ID 1453823216-23167-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit fcd466aaff8fc0f6bd607f3a6eaa3b451d032beb
Headers show

Commit Message

Maxim Uvarov Jan. 26, 2016, 3:46 p.m. UTC
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 test/validation/timer/timer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Ivan Khoronzhuk Jan. 26, 2016, 4:06 p.m. UTC | #1
On 26.01.16 17:46, Maxim Uvarov wrote:
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

> ---
>   test/validation/timer/timer.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
> index 5d89700..0bd67fb 100644
> --- a/test/validation/timer/timer.c
> +++ b/test/validation/timer/timer.c
> @@ -405,12 +405,14 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
>   		thr, nstale);
>
>   	/* Delay some more to ensure timeouts for expired timers can be
> -	 * received */
> +	 * received. Can not use busy loop here to make background timer
> +	 * thread finish their work. */
>   	struct timespec ts;
>   	ts.tv_sec = 0;
> -	ts.tv_nsec = 1000000; /* 1ms */
> +	ts.tv_nsec = (3 * RANGE_MS / 10 + 50) * ODP_TIME_MSEC_IN_NS;
>   	if (nanosleep(&ts, NULL) < 0)
>   		CU_FAIL_FATAL("nanosleep failed");
> +
>   	while (nstale != 0) {
>   		odp_event_t ev = odp_queue_deq(queue);
>   		if (ev != ODP_EVENT_INVALID) {
>
Maxim Uvarov Jan. 27, 2016, 11:49 a.m. UTC | #2
Merged,
Maxim.

On 01/26/2016 19:06, Ivan Khoronzhuk wrote:
>
>
> On 26.01.16 17:46, Maxim Uvarov wrote:
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>
> Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>
>> ---
>>   test/validation/timer/timer.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/test/validation/timer/timer.c 
>> b/test/validation/timer/timer.c
>> index 5d89700..0bd67fb 100644
>> --- a/test/validation/timer/timer.c
>> +++ b/test/validation/timer/timer.c
>> @@ -405,12 +405,14 @@ static void *worker_entrypoint(void *arg 
>> TEST_UNUSED)
>>           thr, nstale);
>>
>>       /* Delay some more to ensure timeouts for expired timers can be
>> -     * received */
>> +     * received. Can not use busy loop here to make background timer
>> +     * thread finish their work. */
>>       struct timespec ts;
>>       ts.tv_sec = 0;
>> -    ts.tv_nsec = 1000000; /* 1ms */
>> +    ts.tv_nsec = (3 * RANGE_MS / 10 + 50) * ODP_TIME_MSEC_IN_NS;
>>       if (nanosleep(&ts, NULL) < 0)
>>           CU_FAIL_FATAL("nanosleep failed");
>> +
>>       while (nstale != 0) {
>>           odp_event_t ev = odp_queue_deq(queue);
>>           if (ev != ODP_EVENT_INVALID) {
>>
>
diff mbox

Patch

diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index 5d89700..0bd67fb 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -405,12 +405,14 @@  static void *worker_entrypoint(void *arg TEST_UNUSED)
 		thr, nstale);
 
 	/* Delay some more to ensure timeouts for expired timers can be
-	 * received */
+	 * received. Can not use busy loop here to make background timer
+	 * thread finish their work. */
 	struct timespec ts;
 	ts.tv_sec = 0;
-	ts.tv_nsec = 1000000; /* 1ms */
+	ts.tv_nsec = (3 * RANGE_MS / 10 + 50) * ODP_TIME_MSEC_IN_NS;
 	if (nanosleep(&ts, NULL) < 0)
 		CU_FAIL_FATAL("nanosleep failed");
+
 	while (nstale != 0) {
 		odp_event_t ev = odp_queue_deq(queue);
 		if (ev != ODP_EVENT_INVALID) {