Re: Safe unlocking
From: those who know me have no need of my name (not-a-real-address_at_usa.net)
Date: 11/28/03
- Previous message: Vladimir Zolotykh: "Safe unlocking"
- In reply to: Vladimir Zolotykh: "Safe unlocking"
- Next in thread: Vladimir Zolotykh: "Re: Safe unlocking"
- Reply: Vladimir Zolotykh: "Re: Safe unlocking"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Nov 2003 12:13:06 GMT
in comp.unix.misc i read:
>Suppose my program starts with creating and locking the file as the
>follows:
>I think that you'll readily agree that calling SIGNAL(2) for each possible
>signal number would be rather clumsy.
i don't agree. please do call signal (or better, sigaction) for each
signal which you need to handle.
>Therefore my question: what is the sure-fire way to remove lock file
>come well, come ill?
one simplistic way to handle normal sorts of unexpected death is to fork
after creating the lock file, then let the parent remove it when the child
(which does all the work) exits.
but there is no sure-fire way, because there are things that can happen
which can terminate your process which cannot be caught (e.g., SIGKILL or a
power glitch), so it's probably better for you to plan to validate the lock
file in some fashion (then `steal' the lock if the validation fails).
-- a signature
- Previous message: Vladimir Zolotykh: "Safe unlocking"
- In reply to: Vladimir Zolotykh: "Safe unlocking"
- Next in thread: Vladimir Zolotykh: "Re: Safe unlocking"
- Reply: Vladimir Zolotykh: "Re: Safe unlocking"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|