|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 1/2] lib/uklock: Use timeout equal to 0 for trying down a semaphore
Hi,
looks good to me.
Reviewed-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
Cheers, Yuri.
Costin Lupu <costin.lupu@xxxxxxxxx> writes:
> Until now, timeout equal to 0 meant waiting until the semaphore counter
> would have got greater than zero, potentially forever. We allow now timeout
> equal to 0 to be used when the user wants just to try down the semaphore
> and return immediately, in order to be compliant with the behavior of the
> sem_timedwait() POSIX function.
>
> Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
> ---
> lib/uklock/include/uk/semaphore.h | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/lib/uklock/include/uk/semaphore.h
> b/lib/uklock/include/uk/semaphore.h
> index dea9a720..2513d441 100644
> --- a/lib/uklock/include/uk/semaphore.h
> +++ b/lib/uklock/include/uk/semaphore.h
> @@ -97,10 +97,7 @@ static inline __nsec uk_semaphore_down_to(struct
> uk_semaphore *s,
>
> UK_ASSERT(s);
>
> - if (timeout == 0)
> - deadline = 0;
> - else
> - deadline = then + timeout;
> + deadline = then + timeout;
>
> for (;;) {
> uk_waitq_wait_event_deadline(&s->wait, s->count > 0, deadline);
> --
> 2.11.0
>
--
Yuri Volchkov
Software Specialist
NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |