]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/thread.h
Make storing non-trivial data in wxThreadSpecificInfo possible.
[wxWidgets.git] / interface / wx / thread.h
index 5ec3a58a8c3340bc2f2ca0f7c349cf58f50feeeb..61becf58477f3db70eaa99869171da606aff550f 100644 (file)
@@ -169,6 +169,33 @@ public:
     */
     wxCondError Wait();
 
+    /**
+        Waits until the condition is signalled and the associated condition true.
+
+        This is a convenience overload that may be used to ignore spurious
+        awakenings while waiting for a specific condition to become true.
+
+        Equivalent to
+        @code
+        while ( !predicate() )
+        {
+            wxCondError e = Wait();
+            if ( e != wxCOND_NO_ERROR )
+                return e;
+        }
+        return wxCOND_NO_ERROR;
+        @endcode
+
+        The predicate would typically be a C++11 lambda:
+        @code
+        condvar.Wait([]{return value == 1;});
+        @endcode
+
+        @since 3.0
+    */
+    template<typename Functor>
+    wxCondError Wait(const Functor& predicate);
+
     /**
         Waits until the condition is signalled or the timeout has elapsed.