From ce2c4e5ea72b28e8dedb43fd2396c160ea1d36fc Mon Sep 17 00:00:00 2001 From: Pavel Gurvich Date: Thu, 27 Feb 2014 14:15:42 +0200 Subject: [PATCH] UsbDk: Make list enumeration interruptible Functor may return false to stop enumeration Signed-off-by: Pavel Gurvich Signed-off-by: Dmitry Fleytman --- UsbDk/UsbDkUtil.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/UsbDk/UsbDkUtil.h b/UsbDk/UsbDkUtil.h index 21f511a..a76c9e4 100644 --- a/UsbDk/UsbDkUtil.h +++ b/UsbDk/UsbDkUtil.h @@ -128,7 +128,10 @@ public: CLockedContext LockedContext(*this); while (!IsListEmpty(&m_List)) { - Functor(Pop_LockLess()); + if (!Functor(Pop_LockLess())) + { + return; + } } } @@ -160,7 +163,10 @@ private: if (Predicate(Object)) { Prepare(CurrEntry); - Functor(Object); + if (!Functor(Object)) + { + return; + } } } }