sdm: Handle spurious wakeup from pthread_cond_wait

SDM uses entry/exit lock in draw thread to prevent other threads from
executing in between prepare/set phases. However, waiting threads may
be woken up from pthread_cond_wait "spuriously" and if they don't
re-evaluate the predicate, they could execute when they shouldn't.

To quote the Holy Man Page for pthread_cond_wait:
"When using condition variables there is always a Boolean predicate
involving shared variables associated with each condition wait that
is true if the thread should proceed. Spurious wakeups from the
pthread_cond_timedwait() or pthread_cond_wait() functions may occur.
Since the return from pthread_cond_timedwait() or pthread_cond_wait()
does not imply anything about the value of this predicate, the
predicate should be re-evaluated upon such return"

Change-Id: I812a19b151fce719653055a0136e3c8da455b70c
CRs-fixed: 1010600
diff --git a/sdm/include/utils/locker.h b/sdm/include/utils/locker.h
index bc24ad5..fffe634 100644
--- a/sdm/include/utils/locker.h
+++ b/sdm/include/utils/locker.h
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted
 * provided that the following conditions are met:
@@ -89,7 +89,7 @@
     explicit SequenceWaitScopeLock(Locker& locker) : locker_(locker), error_(false) {
       locker_.Lock();
 
-      if (locker_.sequence_wait_ == 1) {
+      while (locker_.sequence_wait_ == 1) {
         locker_.Wait();
         error_ = (locker_.sequence_wait_ == -1);
       }