X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8c6471af3cf87c97f5f1564c601237caf9fdeb60..92c0fc34c104c8d7c12d6a3b78ea232690fc23f4:/interface/wx/thread.h diff --git a/interface/wx/thread.h b/interface/wx/thread.h index 5ec3a58a8c..61becf5847 100644 --- a/interface/wx/thread.h +++ b/interface/wx/thread.h @@ -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 + wxCondError Wait(const Functor& predicate); + /** Waits until the condition is signalled or the timeout has elapsed.