Don't unlock and lock the thread mutex unnecessarily.
authorAndre Noll <maan@systemlinux.org>
Mon, 3 Feb 2014 19:45:15 +0000 (20:45 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 6 Apr 2014 06:53:26 +0000 (08:53 +0200)
ao_write.c

index d1d62a6..5c14aa7 100644 (file)
@@ -367,10 +367,10 @@ static int aow_post_select(__a_unused struct sched *s,
                        goto remove_thread_btrn;
                }
        }
-       pthread_mutex_unlock(&pawd->mutex);
-       if (ret >= 0)
+       if (ret >= 0) {
+               pthread_mutex_unlock(&pawd->mutex);
                goto out;
-       pthread_mutex_lock(&pawd->mutex);
+       }
        btr_remove_node(&wn->btrn);
        pthread_cond_signal(&pawd->data_available);
        pthread_mutex_unlock(&pawd->mutex);