I have used one pthread for polling network every 2 secs. For this I am calling one Client Interface from run() method of pthread. But what is happening when network is down between server and client this method should throw exception, but this is not happening right now.So what I planning is to forcefully return this method and exit the thread.
To achieve this I have tried to forcefully exit from thread by signaling it. But the problem I am still facing is that after exitting from thread itself client inteface is throwing exception very late.This leading to inconsistent behaviour in my implementation.
My code looks like this
//server side code
//This is Linux code
void ServerImp::run()
{
try {
while(1)
{
Client->PingNetwork()
}
}
catch(...)
{
//Handle exception
}
}
//PingNetwork implementation
//This is Windows code
void NetworkImpl::PingNetwork() throw exception
{
try{
while(IsValidClient())//This will return as soon as client disconnected from server
{
sleep(2);
}
}
catch(...)
{
//Handle exception
}
}
Basic idea to ask this question is that for me my underlying interace TAO 2.0a is not detecting network failure immediately for current session but on client side it detect it well in time and initiate one more new session for connection.But after sometime both new and old session got CORBA::COMM_FAILURE exception so it leading to unstable behaviour in server and client. Is that something TAO limitation? or I have to do something to make it work. Please help me out if is there any way to work around here.
Thanks