aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorHo-Eun Ryu <ho-eun.ryu@windriver.com>2009-09-25 14:34:41 +0900
committerPatrick Tjin <pattjin@google.com>2014-07-21 22:03:24 -0700
commit94971622bc073a4057f6f02ffb61b6977c2bd4e6 (patch)
tree4d1f26c97846d6e6ed90119cc3010d4840df343f /utils
parent27553108e3ec272ee7f4ec9a4da2f2c22dafb36f (diff)
downloadwrs_omxil_core-94971622bc073a4057f6f02ffb61b6977c2bd4e6.tar.gz
utils:workqueue: add CancelScheduledWork() function
this function discards qeueud works in works list to cancel queued job;
Diffstat (limited to 'utils')
-rw-r--r--utils/inc/workqueue.h3
-rw-r--r--utils/src/workqueue.cpp7
2 files changed, 9 insertions, 1 deletions
diff --git a/utils/inc/workqueue.h b/utils/inc/workqueue.h
index 20f4bc1..712e071 100644
--- a/utils/inc/workqueue.h
+++ b/utils/inc/workqueue.h
@@ -40,7 +40,8 @@ public:
* the class.
*/
void FlushWork(void);
- //void CancelWork(WorkableInterface *wi);
+ /* remove all scheduled works matched with wi from workqueue list */
+ void CancelScheduledWork(WorkableInterface *wi);
private:
/* inner class for flushing */
diff --git a/utils/src/workqueue.cpp b/utils/src/workqueue.cpp
index 6e281e1..2b5e47b 100644
--- a/utils/src/workqueue.cpp
+++ b/utils/src/workqueue.cpp
@@ -94,6 +94,13 @@ void WorkQueue::ScheduleWork(WorkableInterface *wi)
pthread_mutex_unlock(&wlock);
}
+void WorkQueue::CancelScheduledWork(WorkableInterface *wi)
+{
+ pthread_mutex_lock(&wlock);
+ works = list_delete_all(works, wi);
+ pthread_mutex_unlock(&wlock);
+}
+
void WorkQueue::FlushWork(void)
{
FlushBarrier fb;