diff options
author | Tyler Luu <tluu@ti.com> | 2011-09-13 11:03:04 -0500 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-09-14 16:00:42 -0700 |
commit | 46ea6dedfa4f9423783327adccdac9f0a2d603ce (patch) | |
tree | ac70d219db59dd42e0a3496b4878074842244eb7 /camera/inc | |
parent | 0079bde0245d1da7770b28598d16ba148ac48302 (diff) | |
download | hardware_ti_omap4-46ea6dedfa4f9423783327adccdac9f0a2d603ce.zip hardware_ti_omap4-46ea6dedfa4f9423783327adccdac9f0a2d603ce.tar.gz hardware_ti_omap4-46ea6dedfa4f9423783327adccdac9f0a2d603ce.tar.bz2 |
CameraHal: Modify exit behavior of notify thread
When the camera app dies, sometimes the release() call is coming
from the same thread as a callback instead of the main thread. When this
happens, it causes a segfault in AppCallbackNotifier because we end up
destroying AppCallbackNotifier without the NotificationThread knowing.
The subsequent waitForMsg() after release() will result in a segfault since
the message queues are deleted.
Instead of looping forever in a while loop in the notification thread,
return bool value in looper function. This gives the Thread class a chance
to exit in case of a requestExit() in the same thread. Looper function
will automatically will be called again if exit is not pending and
previous looper function call returned true.
Change-Id: I6bdc65df71e2c3ebcbd409654b828edef29b1a0e
Signed-off-by: Tyler Luu <tluu@ti.com>
Diffstat (limited to 'camera/inc')
-rw-r--r-- | camera/inc/CameraHal.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h index 38727a2..47bd589 100644 --- a/camera/inc/CameraHal.h +++ b/camera/inc/CameraHal.h @@ -523,7 +523,7 @@ public: void setMeasurements(bool enable); //thread loops - void notificationThread(); + bool notificationThread(); ///Notification callback functions static void frameCallbackRelay(CameraFrame* caFrame); @@ -568,8 +568,7 @@ public: NotificationThread(AppCallbackNotifier* nh) : Thread(false), mAppCallbackNotifier(nh) { } virtual bool threadLoop() { - mAppCallbackNotifier->notificationThread(); - return false; + return mAppCallbackNotifier->notificationThread(); } TIUTILS::MessageQueue &msgQ() { return mNotificationThreadQ;} |