bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/7] Fix double call to pthread_mutex_unlock in kbd_repeat_ke


From: Samuel Thibault
Subject: Re: [PATCH 2/7] Fix double call to pthread_mutex_unlock in kbd_repeat_key().
Date: Mon, 17 Dec 2012 01:20:40 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Cyril Roelandt, le Mon 17 Dec 2012 00:51:25 +0100, a écrit :
>    pthread_mutex_lock (&global_lock);
>    while (kbdbuf.size + sizeof (kd_event) > KBDBUFSZ)
>      {
> -      /* The input buffer is full, wait until there is some space.  */
> -      if (pthread_hurd_cond_wait_np (&kbdbuf.writecond, &global_lock))
> -     {
> -       pthread_mutex_unlock (&global_lock);
> -       /* Interrupt, silently continue.  */
> -     }
> +      /* The input buffer is full, wait until there is some space. If this 
> call
> +       * is interrupted, silently continue. */
> +      (void) pthread_hurd_cond_wait_np (&kbdbuf.writecond, &global_lock);
>      }
>    ev = (kd_event *) &kbdbuf.keybuffer[KBDBUF_POS (kbdbuf.pos 

I was afraid hurd_cond_wait_np might have a different semantic that
cond_wait, but it doesn't seem so, and not only unlocking is spurious,
but nothing should be done here indeed.

Thanks,
Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]