thread_loop: signal only when status changes to OK

The corresponding wait in change_state() waits until the worker's status
becomes OK. So the worker only needs to signal when it changes its
status to OK.

Change-Id: I3573f5bff9fcc4a89857d81bb134b518253e1669
diff --git a/aom_util/aom_thread.c b/aom_util/aom_thread.c
index dbb71b3..04a0bd6 100644
--- a/aom_util/aom_thread.c
+++ b/aom_util/aom_thread.c
@@ -79,11 +79,11 @@
       pthread_mutex_lock(&worker->impl_->mutex_);
       assert(worker->status_ == WORK);
       worker->status_ = OK;
+      // signal to the main thread that we're done (for sync())
+      pthread_cond_signal(&worker->impl_->condition_);
     } else if (worker->status_ == NOT_OK) {  // finish the worker
       done = 1;
     }
-    // signal to the main thread that we're done (for sync())
-    pthread_cond_signal(&worker->impl_->condition_);
     pthread_mutex_unlock(&worker->impl_->mutex_);
   }
   return THREAD_RETURN(NULL);  // Thread is finished