mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
enh(Poco::Util::Timer): Add idle() method to check if timer has any tasks scheduled #4488
This commit is contained in:
@@ -159,6 +159,9 @@ public:
|
||||
/// If task execution takes longer than the given interval,
|
||||
/// further executions are delayed.
|
||||
|
||||
bool idle() const;
|
||||
/// Returns true if the task queue is empty, otherwise false.
|
||||
|
||||
template <typename Fn>
|
||||
static TimerTask::Ptr func(const Fn& fn)
|
||||
/// Helper function template to use a functor or lambda
|
||||
@@ -188,6 +191,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inlines
|
||||
//
|
||||
inline bool Timer::idle() const
|
||||
{
|
||||
return _queue.empty();
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Util
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user