[pacman-dev] trans.c : reworking of transaction interruptions.
shiningxc at gmail.com
Fri Sep 7 18:45:14 EDT 2007
My two previous hack related to this part (8038190c7c4786e1c49494eea1b40cdddcbd5136
and b15a5194d1a8485a2769560e49e6ff03e1862533) were caused by the lack of understanding
of a feature introduced a while ago :
Better control over CTRL-C interruptions -- do not leave the DB in an inconsistent state
Now I have been looking at this commit, and the added feature is indeed interesting.
The main problem I had with it is that it does a rather unusual use of alpm_trans_release,
which caused a few problems that I tried to fix in a weird way. I think these problems were
caused by the fact that there wasn't any difference between an "interrupt transaction" and
a "release a transaction which failed" actions from alpm_trans_release POV.
So I decided to add a new function instead, alpm_trans_interrupt, which is called on Ctrl+C,
and which only sets trans->state to STATE_INTERRUPTED so that remove_commit and add_commit
can exit cleanly at a safe moment.
This allowed me to revert my two previous hacks as well.
Signed-off-by: Chantry Xavier <shiningxc at gmail.com>
lib/libalpm/add.c | 8 +++-----
lib/libalpm/alpm.h | 1 +
lib/libalpm/db.c | 6 ++----
lib/libalpm/remove.c | 5 ++---
lib/libalpm/trans.c | 33 ++++++++++++++++++++++-----------
src/pacman/pacman.c | 4 ++--
6 files changed, 32 insertions(+), 25 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5270 bytes
Desc: not available
More information about the pacman-dev