Improving error handling for threads.

If a thread command fails (like the input framework not finding a
file), that now (1) no longer hangs Bro, and (2) even allows for
propagating error messages back before the thread is stops.

(Actually, the thread doesn't really "stop"; the thread manager keeps
threads around independent of their success; but it no longer polls
them for input.)

Closes #858.
This commit is contained in:
Robin Sommer 2012-07-26 16:31:20 -07:00
parent ef3b75129f
commit 743fc1680d
3 changed files with 39 additions and 14 deletions

View file

@ -74,6 +74,16 @@ public:
*/
void ForceProcessing() { Process(); }
/**
* Signals a specific threads to terminate immediately.
*/
void KillThread(BasicThread* thread);
/**
* Signals all threads to terminate immediately.
*/
void KillThreads();
protected:
friend class BasicThread;
friend class MsgThread;
@ -106,13 +116,6 @@ protected:
*/
virtual double NextTimestamp(double* network_time);
/**
* Kills all thread immediately. Note that this may cause race conditions
* if a child thread currently holds a lock that might block somebody
* else.
*/
virtual void KillThreads();
/**
* Part of the IOSource interface.
*/