On Feb 6, 2006, at 17:57, David Nicol wrote:

i used to always open a separate file explicitly for locking, and
flock that file,
instead of fooling around with db internals. DBM, in particular, opens two
files.  Which one, if either, does tie() return?  What if you switch
to a database
that does not use a fh as the tie object? By explicitly controlling
what you are flocking
you can even interoperate with, for instance, C programs that use the same DBM
and can respect the same traffic light.

    open FLOCK_THIS, ">>$DatabaseName.lock";
    flock FLOCK_THIS, FLOCK_EX;
    tie %DB, ...
    ...
    untie %DB;
    flock FLOCK_THIS, FLOCK_UN;


Well, that's precisely what DB_File::Lock does, but is this the best method?

        dZ.

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to