This discussion is archived
2 Replies Latest reply: Dec 10, 2012 12:09 AM by 978552 RSS

Exclusive lock for a whole database

978552 Newbie
Currently Being Moderated
Is there some way to acquire an exclusive write lock for a whole Berkeley DB database without having to close it and reopen it using Db::set_lk_exclusive()?

Perhaps using DbEnv::lock_get()? But in this case, how should it be called? I haven't found any examples about it.

Thanks.
  • 1. Re: Exclusive lock for a whole database
    LaurenFoutz Journeyer
    Currently Being Moderated
    There is no way to get an exclusive write lock on a BDB database if you have already opened it to use page level locking. DbEnv::lock_get(), and the rest of the lock interface, should really only be used if you plan to manage all locks obtained in the environment.

    What are you trying to achive by getting an exclusive write lock on the database? Maybe I can help you achieve your goal without he exclusive lock.

    Lauren Foutz
  • 2. Re: Exclusive lock for a whole database
    978552 Newbie
    Currently Being Moderated
    Thanks for your reply! I'm implementing a front-end for various key/value store databases, and that's one of the requested features. If it's not possible, I think I will implement it at the application level. Thanks.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points