Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Timer to IceInternal, add InlineTimerTask #2923

Merged
merged 2 commits into from
Oct 17, 2024

Conversation

bernardnormier
Copy link
Member

This PR fixes #2877.

@@ -43,6 +55,13 @@ namespace Ice
// Destroy the timer and join the timer execution thread. Must not be called from a timer task.
void destroy();

// Schedule a function-task for execution after a given delay.
template<class Rep, class Period>
void schedule(std::function<void()> function, const std::chrono::duration<Rep, Period>& delay)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original DataStorm Timer API, schedule returned a "cancel" function. This supports cancellation while storing std::function.

We could refactor IceInternal::Timer to use this old DataStorm API but it would be much more work. And it would be difficult to implement isScheduled.

cpp/include/Ice/Initialize.h Show resolved Hide resolved
@bernardnormier bernardnormier merged commit b631a08 into zeroc-ice:main Oct 17, 2024
17 checks passed
InsertCreativityHere pushed a commit to InsertCreativityHere/compiler-comparison that referenced this pull request Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve C++ Timer class to accept std::function as a task
3 participants