23 Mar
2009
23 Mar
'09
10:15 a.m.
Just one last thing..
I've tried to to something like this (where signal_OnData is a signal):
void SerialPort::reading() { .... data available... //signal_OnData(); _io.post( boost::bind(&SerialPort::Post_OnData, this) ); }
void SerialPort::Post_OnData() { signal_OnData(); };
but the SerialPort::Post_OnData is not called, is this my design wrong?
I guess that your io_service is not running, so noone processes its queue. You have to call io_service::run function, it's kindof "message loop" of io_service: http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/tutorial/tutdaytime...