am 1ae7831b: am 8b1243e5: jni: GpsLocationProvider: Check for pending callbacks before waiting

Merge commit '1ae7831b8a90a9c0c614790027ce88d5fe75cf93' into eclair-mr2-plus-aosp

* commit '1ae7831b8a90a9c0c614790027ce88d5fe75cf93':
  jni: GpsLocationProvider: Check for pending callbacks before waiting
diff --git a/core/jni/android_location_GpsLocationProvider.cpp b/core/jni/android_location_GpsLocationProvider.cpp
index 4aed277..f845878 100755
--- a/core/jni/android_location_GpsLocationProvider.cpp
+++ b/core/jni/android_location_GpsLocationProvider.cpp
@@ -266,7 +266,9 @@
 static void android_location_GpsLocationProvider_wait_for_event(JNIEnv* env, jobject obj)
 {
     pthread_mutex_lock(&sEventMutex);
-    pthread_cond_wait(&sEventCond, &sEventMutex);
+    while (sPendingCallbacks == 0) {
+        pthread_cond_wait(&sEventCond, &sEventMutex);
+    }
 
     // copy and clear the callback flags
     int pendingCallbacks = sPendingCallbacks;