Max Frai
Max Frai

Reputation: 64356

Timers and threads

I have a function which should be called with an interval of 0.5 seconds in its own thread.

Is there a feature in boost or another library which allows to connect a timer which works in callback-like mode and runs callback for a given time interval?

Upvotes: 2

Views: 1617

Answers (3)

nate_weldon
nate_weldon

Reputation: 2349

sounds more like you want a repeating timer with a callback

you can normally do this with boost and binding...here is a good walk though

http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/tutorial/tuttimer3.html

Upvotes: 0

Fraser
Fraser

Reputation: 78428

You can use boost::asio::deadline_timer for that.

Upvotes: 3

learnvst
learnvst

Reputation: 16193

I use JUCE for timers. It allows you to subclass the timer class using multiple inheritance, set a timer running, and then define a callback function to handle the timer events extremely easily.

http://www.rawmaterialsoftware.com/

There are probably many libs that offer similar functionality.

Upvotes: 2

Related Questions