Cleanup joinable threads on termination
Always invoke pthread_join() when we blow up a thread via pthread_cancel() (avoid zombie threads). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
4cd62fb0fb
commit
3aefd00f6a
@ -145,7 +145,10 @@ void
|
|||||||
calendar_stop_date_thread (void)
|
calendar_stop_date_thread (void)
|
||||||
{
|
{
|
||||||
if (calendar_t_date)
|
if (calendar_t_date)
|
||||||
pthread_cancel (calendar_t_date);
|
{
|
||||||
|
pthread_cancel (calendar_t_date);
|
||||||
|
pthread_join (calendar_t_date, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set static variable today to current date */
|
/* Set static variable today to current date */
|
||||||
|
5
src/io.c
5
src/io.c
@ -2927,7 +2927,10 @@ void
|
|||||||
io_stop_psave_thread (void)
|
io_stop_psave_thread (void)
|
||||||
{
|
{
|
||||||
if (io_t_psave)
|
if (io_t_psave)
|
||||||
pthread_cancel (io_t_psave);
|
{
|
||||||
|
pthread_cancel (io_t_psave);
|
||||||
|
pthread_join (io_t_psave, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -188,7 +188,10 @@ void
|
|||||||
notify_stop_main_thread (void)
|
notify_stop_main_thread (void)
|
||||||
{
|
{
|
||||||
if (notify_t_main)
|
if (notify_t_main)
|
||||||
pthread_cancel (notify_t_main);
|
{
|
||||||
|
pthread_cancel (notify_t_main);
|
||||||
|
pthread_join (notify_t_main, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user