I am having some problems with boost::signals version 1_30_0 on XP,
compiled and linked using VC6.
I am building a timer mechanism, similar to that with Qt.
A user instanciates a timer with some millisecond value, starts the
timer via t.Start(), and then enters the event loop (or in most
cases, returns from a function call by the event loop).
Timer definition:
class Timer {
typedef boost::signal1 TimerSignalType;
typedef TimerSignalType::slot_type TimerSlotType;
public:
boost::signals::connection TimerConnect(const TimerSlotType& slot )
{ return OnRing.connect( slot ); }
Timer();
Timer( const Timer& );
Timer( unsigned long millesecInterval, TimerType t = Continous );
~Timer();
void Start();
void Ring() {OnRing( myId );}
private:
TimerSignalType OnRing;
int myId;
};
void Rang( int i )
{
cout << "Received timer " << endl;
}
main()
{
EventLoop *eventLoop = EventLoop::Instance();
Timer t1( 3000, Continous );
t1.TimerConnect( boost::bind( Rang, _1) );
t1.Start();
eventLoop->Exec();
}
eventLoop->Exec() start an event loop.
The code always crashes when atteping to execute the connected
function.
What am I doing wrong?
Ray