Acked-by: Ethan Jackson <et...@nicira.com>

There was some reason why I thought we needed the mutex before
checking the latch, but I can't seem to figure out what it was.

Ethan

On Fri, Dec 27, 2013 at 11:03 PM, Ben Pfaff <b...@nicira.com> wrote:
> Signed-off-by: Ben Pfaff <b...@nicira.com>
> ---
>  ofproto/ofproto-dpif-upcall.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
> index 8369959..37171be 100644
> --- a/ofproto/ofproto-dpif-upcall.c
> +++ b/ofproto/ofproto-dpif-upcall.c
> @@ -625,17 +625,11 @@ udpif_upcall_handler(void *arg)
>      handler->name = xasprintf("handler_%u", ovsthread_id_self());
>      set_subprogram_name("%s", handler->name);
>
> -    for (;;) {
> +    while (!latch_is_set(&handler->udpif->exit_latch)) {
>          struct list misses = LIST_INITIALIZER(&misses);
>          size_t i;
>
>          ovs_mutex_lock(&handler->mutex);
> -
> -        if (latch_is_set(&handler->udpif->exit_latch)) {
> -            ovs_mutex_unlock(&handler->mutex);
> -            return NULL;
> -        }
> -
>          if (!handler->n_upcalls) {
>              ovs_mutex_cond_wait(&handler->wake_cond, &handler->mutex);
>          }
> @@ -654,6 +648,8 @@ udpif_upcall_handler(void *arg)
>
>          coverage_clear();
>      }
> +
> +    return NULL;
>  }
>
>  static void *
> --
> 1.7.10.4
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to