namespace android {
static Mutex singleton_lock;
+static bool singleton_releasing;
+static Condition singleton_wait;
static void receive_camframe_callback(struct msm_frame *frame);
static void receive_jpeg_fragment_callback(uint8_t *buff_ptr, uint32_t buff_size);
}
#endif
+ Mutex::Autolock lock(&singleton_lock);
+ singleton_releasing = true;
+
LOGD("release X");
}
LOGD("~QualcommCameraHardware E");
Mutex::Autolock lock(&singleton_lock);
singleton.clear();
+ singleton_releasing = false;
+ singleton_wait.signal();
LOGD("~QualcommCameraHardware X");
}
LOGD("createInstance: E");
Mutex::Autolock lock(&singleton_lock);
+
+ // Wait until the previous release is done.
+ while (singleton_releasing) {
+ LOGD("Wait for previous release.");
+ singleton_wait.wait(singleton_lock);
+ }
+
if (singleton != 0) {
sp<CameraHardwareInterface> hardware = singleton.promote();
if (hardware != 0) {