Using free in a signal handler may cause a dead lock.. This patch
makes the stop handler set a stop flag and do "stop listening" work
in main thread.
double m_duration_max;
double m_duration_min;
double m_duration_total;
+ bool m_stop;
public:
Rep();
~Rep();
m_duration_max = 0.0;
m_duration_min = 0.0;
m_duration_total = 0.0;
+ m_stop = false;
}
yf::FrontendNet::Rep::~Rep()
void yf::FrontendNet::stop() const
{
- if (m_p->az)
- {
- size_t i;
- for (i = 0; i < m_p->m_ports.size(); i++)
- m_p->az[i]->server("");
- }
+ m_p->m_stop = true;
}
bool yf::FrontendNet::My_Timer_Thread::timeout()
}
while (m_p->mySocketManager.processEvent() > 0)
{
+ if (m_p->m_stop)
+ {
+ m_p->m_stop = false;
+ if (m_p->az)
+ {
+ size_t i;
+ for (i = 0; i < m_p->m_ports.size(); i++)
+ m_p->az[i]->server("");
+ }
+ }
int no = m_p->mySocketManager.getNumberOfObservers();
if (no <= 1)
break;