diff options
author | Lars Henriksen <LarsHenriksen@get2net.dk> | 2020-07-14 08:45:39 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2020-07-26 10:31:33 -0400 |
commit | 7b8b7f0548c2f71a1a068419f5712e2d7026485f (patch) | |
tree | 3127af0b623f2558faa82838325f939233de9736 /src/mem.c | |
parent | 2230525f4a14ae9e8a5e7a76ae205101904a7f7f (diff) | |
download | calcurse-7b8b7f0548c2f71a1a068419f5712e2d7026485f.tar.gz calcurse-7b8b7f0548c2f71a1a068419f5712e2d7026485f.zip |
Revert "Interrupt periodic save when launching process"
This reverts commit 0f3d198 (Interrupt periodic save when launching
process, 2017-09-08).
Stopping and starting periodic save when external/hook programs are run
causes deadlocks. The periodic save thread cannot be stopped/started at
will, but should be started once and run uninterrupted as long as
calcurse runs. Only if the configuration parameter is changed, must the
thread be stopped and possibly restarted.
The reasons are
- the start routine unconditionally starts a thread.
- the mechanism used to detect whether a thread is running or not, is
designed to be used by the main calcurse thread only and with only one
running thread of each kind (the thread ID of each running thread is
kept in a variable; if the thread is not running, the variable has the
main thread ID as value).
Any load hook will be run at the initial dataload, and the stop/start
calls will start a perodic save thread (this is true for the notify
thread as well). Later when threads are started, a second periodic save
thread is started (for the notify thread, a running thread is stopped
before restart).
When hooks are run by the periodic save thread, the stop call breaks
down, leading to two running save threads (if not the case already) and
subsequently to a deadlock when one thread tries to stop the other.
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/mem.c')
0 files changed, 0 insertions, 0 deletions