mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Reworking forceful thread termination.
Ctrl-C now kills a thread even if it hangs at termination. And readded a (rather long) timeout to kill threads automatically that don't shutdown.
This commit is contained in:
parent
e90918aa50
commit
490859cfef
6 changed files with 50 additions and 12 deletions
|
@ -125,7 +125,7 @@ void BasicThread::Join()
|
|||
|
||||
DBG_LOG(DBG_THREADING, "Joining thread %s ...", name.c_str());
|
||||
|
||||
if ( pthread_join(pthread, 0) != 0 )
|
||||
if ( pthread && pthread_join(pthread, 0) != 0 )
|
||||
reporter->FatalError("Failure joining thread %s", name.c_str());
|
||||
|
||||
DBG_LOG(DBG_THREADING, "Done with thread %s", name.c_str());
|
||||
|
@ -135,13 +135,13 @@ void BasicThread::Join()
|
|||
|
||||
void BasicThread::Kill()
|
||||
{
|
||||
terminating = true;
|
||||
|
||||
if ( ! (started && pthread) )
|
||||
return;
|
||||
|
||||
// I believe this is safe to call from a signal handler ... Not error
|
||||
// checking so that killing doesn't bail out if we have already
|
||||
// terminated.
|
||||
pthread_kill(pthread, SIGKILL);
|
||||
pthread = 0;
|
||||
pthread_kill(pthread, SIGTERM);
|
||||
}
|
||||
|
||||
void* BasicThread::launcher(void *arg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue