ardour
|
#include <timer.h>
Public Member Functions | |
Timer (unsigned int interval, const Glib::RefPtr< Glib::MainContext > &main_context) | |
unsigned int | get_interval () const |
void | set_interval (unsigned int new_interval) |
virtual unsigned int | connection_count () const =0 |
Protected Member Functions | |
virtual | ~Timer () |
void | start () |
void | stop () |
virtual bool | on_elapsed ()=0 |
Private Member Functions | |
Timer (const Timer &) | |
Timer & | operator= (const Timer &) |
bool | timeout_handler () |
Static Private Member Functions | |
static gboolean | _timeout_handler (void *data) |
Private Attributes | |
GSource * | m_timeout_source |
unsigned int | m_timeout_interval |
const Glib::RefPtr < Glib::MainContext > | m_main_context |
The Timer class is a wrapper around Glib TimeoutSources The Timer will start automatically when the first connection is made and stop when the last callback is disconnected.
PBD::Timer::Timer | ( | unsigned int | interval, |
const Glib::RefPtr< Glib::MainContext > & | main_context | ||
) |
|
private |
|
staticprivate |
|
pure virtual |
Implemented in PBD::BlinkTimer, and PBD::StandardTimer.
|
protectedpure virtual |
Implemented in PBD::BlinkTimer, and PBD::StandardTimer.
|
protected |
We don't use Glibmm::TimeoutSource::create() here as contrary to the documentation, SignalTimeout::connect and manually adding a TimeoutSource to a GMainContext are not equivalent.
SignalTimeout::connect is the equivalent of g_timeout_add in terms off callback timing but TimeoutSource tries to adjust the timeout based on the time elapsed since the last timeout.
On Windows with a high frequency timeout(40ms) this causes a small but noticable increase in CPU Usage.
|
private |