Avoid cancelling the save thread during saving
Ensure that we never cancel the periodic save thread when it currently saves the configuration and data files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
parent
5aec540895
commit
b37ed2fcc8
8
src/io.c
8
src/io.c
@ -1214,10 +1214,14 @@ void io_start_psave_thread(void)
|
|||||||
/* Stop periodic data saves. */
|
/* Stop periodic data saves. */
|
||||||
void io_stop_psave_thread(void)
|
void io_stop_psave_thread(void)
|
||||||
{
|
{
|
||||||
if (io_t_psave) {
|
if (!io_t_psave)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Lock the mutex to avoid cancelling the thread during saving. */
|
||||||
|
io_save_mutex_lock();
|
||||||
pthread_cancel(io_t_psave);
|
pthread_cancel(io_t_psave);
|
||||||
pthread_join(io_t_psave, NULL);
|
pthread_join(io_t_psave, NULL);
|
||||||
}
|
io_save_mutex_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user