On Thu, Dec 28, 2000 at 01:35:08PM +0100, Dag-Erling Smorgrav wrote:
> What are you guys smoking? Use cron to run a spool scanning job every
> minute or so, and use a lock file to make sure one doesn't start until
> the previous one is done. Note that reliable locking is non-trivial in
> Perl; a quick workaround is to use a lock directory instead (mkdir()
> will fail if the directory exists; make sure to differentiate between
> "somebody already holds the lock" and "the lock can't be created due
> to permission errors or some other problem" by examining $!)

I've tried this; and I still believe that a process continuously
watching the directory is better than a cronjob for several reasons,
which I have outlined in a previous mail.  First, there is *no* need
for locking if a single process is there all the time; this eliminates
all sorts of locking problems.  Second, there is no overhead in starting
Perl (yeah, yeah, so it's cached after the first few times, but still..)
each and every minute just to find nothing and die quietly - as somebody
else said, that's exactly why poll(2) and later kqueue/kevent work on
directory vnodes.  Third, if a process uses poll(2) or kqueue, it shall
react on new mails the moment they arrive, not up to a minute later.

G'luck,
Peter

-- 
because I didn't think of a good beginning of it.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to