Howard Chu:
> The first patch adds a lock handler to the dict interface. I needed this
> first, because MDB is fully transactional and does its own locking/concurrency
> management. In particular, it does MVCC so readers always run lockless; since
> they're fully isolated there's no actual need for "shared locks."
I have added a lock function pointer to the dictionary data structure,
so that a specific dictionary can override it if needed.
This locking function is not exposed to applications: it is used
only by dict_open(). Applications rely on the dict_open()
"lock-on-open" feature for maps that aren't multi-writer safe.
A multi-writer safe table like MDB could override this function
with a NOOP (or it could leave the lock_fd member equal to -1 and
achieve the exact same result).
In the case of postmap/postalias which truncate databases, a global
lock is needed to prevent readers from looking at an incomplete
database. This has nothing to do with the dict_open() "lock-on-open"
feature for tables that aren't multi-writer safe.
Wietse