From f9df3ee5cfb3c3177bcc630abf6d756e8a60254c Mon Sep 17 00:00:00 2001 From: Sundar Raman Date: Thu, 10 Nov 2011 08:15:13 -0800 Subject: CameraHAL: Clear events queue fix, clear command queue on exit Fix 2/3 for b/5593964. 1. The events queue wasn't being cleared correctly inside OMXCameraAdapter as some items were being removed while the index was being formulated based on the original size 2. The command queue should be cleared before posting the EXIT message for the OMX adapter threads so as not to process those messages since we are exiting Change-Id: I0a5eaceb3d1504fee05b064ebb5fe888e129ad44 Signed-off-by: Sundar Raman Signed-off-by: Iliyan Malchev --- libtiutils/MessageQueue.cpp | 18 ++++++++++++++++++ libtiutils/MessageQueue.h | 2 ++ 2 files changed, 20 insertions(+) (limited to 'libtiutils') diff --git a/libtiutils/MessageQueue.cpp b/libtiutils/MessageQueue.cpp index 28bb0e3..11f5407 100755 --- a/libtiutils/MessageQueue.cpp +++ b/libtiutils/MessageQueue.cpp @@ -276,6 +276,24 @@ bool MessageQueue::isEmpty() return !mHasMsg; } +void MessageQueue::clear() +{ + if(!this->fd_read) + { + MSGQ_LOGEA("read descriptor not initialized for message queue"); + LOG_FUNCTION_NAME_EXIT; + return; + } + + Message msg; + while(!isEmpty()) + { + get(&msg); + } + +} + + /** @brief Force whether the message queue has message or not diff --git a/libtiutils/MessageQueue.h b/libtiutils/MessageQueue.h index 97e11a7..6d05201 100755 --- a/libtiutils/MessageQueue.h +++ b/libtiutils/MessageQueue.h @@ -83,6 +83,8 @@ public: ///Returns if the message queue is empty or not bool isEmpty(); + void clear(); + ///Force whether the message queue has message or not void setMsg(bool hasMsg=false); -- cgit v1.2.3