A
Alfonso Morra
Hi,
I am writing a timer class that I want to be able to get to notify me
(via a callback func), when a specified interval has elapsed. I have
most of the timer functionality figured - however, I need to spawn a new
thread to carry out the "time watch" - and I need to do this in a cross
platform (Well Linux/Windows) way ...
Any help will be mucho appreciated. The code (snippet) follows below:
#include <time.h>
typedef void (*TIMER_CB_FUNC)( void ) ;
class Timer {
public:
Timer() ;
virtual ~Timer() ; //not really required
registerCallBack( TIMER_CB_FUNC, unsigned int ) ;
private
TIMER_CB_FUNC m_cbfunc ;
void restart( void );
unsigned int m_interval ;
time_t m_stime ;
};
I am writing a timer class that I want to be able to get to notify me
(via a callback func), when a specified interval has elapsed. I have
most of the timer functionality figured - however, I need to spawn a new
thread to carry out the "time watch" - and I need to do this in a cross
platform (Well Linux/Windows) way ...
Any help will be mucho appreciated. The code (snippet) follows below:
#include <time.h>
typedef void (*TIMER_CB_FUNC)( void ) ;
class Timer {
public:
Timer() ;
virtual ~Timer() ; //not really required
registerCallBack( TIMER_CB_FUNC, unsigned int ) ;
private
TIMER_CB_FUNC m_cbfunc ;
void restart( void );
unsigned int m_interval ;
time_t m_stime ;
};