How can i legally break interactive input loop from another thread?
class CWorker
{
public:
/** */
void operator()()
{
//...
// !!! break main input loop here !!!
}
/** */
void processCommand( std::string& /*cmd*/ )
{
}
protected:
private:
};
int main(int /*argc*/, char* /*argv*/[] )
{
try
{
CWorker w;
boost::thread work_thread( boost::ref( w ) );
//
std::string str;
while ( std::getline( std::cin, str ) )
{
w.processCommand( str );
}
//
work_thread.join();
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}