[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Read lock without a write lock

Milosz Tanski wrote:
I saw that LMDB recently added a new flag MDB_NOLOCK. Is there a way
to keep the reader lock file and but do away with the write lock?

My motivation for doing this to be able to use LMDB from a process
that forks to share the database. And the application can implement
it's own write lock (mutex in shm or futex on linux).

What advantage do you gain from using your own write lock?

Note that forking to share the database is explicitly *not* supported.

This would be preferable to having to do doing something like a
MDB_NOLOCK with a pthread_rwlock since we could still have parallel
readers with one writer.

  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/