If a thread doesn't terminate, we log that but not longer proceed

(because it could hang later still).

Also logging to stderr as well to make sure one sees it.

Also adding code to the ASCII writer to catch termination
inconsistencies.
This commit is contained in:
Robin Sommer 2012-07-16 13:40:19 -07:00
parent 1ca0d970fc
commit c8789cff94
8 changed files with 23 additions and 10 deletions

View file

@ -166,17 +166,15 @@ void MsgThread::OnStop()
int cnt = 0;
while ( ! finished )
{
if ( ++cnt > 1000 ) // Insurance against broken threads ...
if ( ++cnt % 2000 == 0 ) // Insurance against broken threads ...
{
reporter->Warning("thread %s didn't finish in time", Name().c_str());
break;
reporter->Warning("thread %s has not yet terminated ...", Name().c_str());
fprintf(stderr, "warning: thread %s has not yet terminated ...", Name().c_str());
}
usleep(1000);
}
Finished();
// One more message to make sure the current queue read operation unblocks.
SendIn(new UnblockMessage(this), true);
}