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

Re: mdb_dbi_open and threads



Is the following  valid.

1) Read transaction 1 is started
2) Read transaction 2 is started and calls mdb_dbi_open and commits
3) Read transaction 1 uses the handle from (2)




On Sat, May 20, 2017 at 6:46 PM, Muhammed Muneer <elendilm@gmail.com> wrote:
Thanks.

On Sat, May 20, 2017 at 6:29 PM, Klaus Malorny <Klaus.Malorny@knipp.de> wrote:
On 5/20/17 2:02 PM, Muhammed Muneer wrote:
So when the doc says

      * The database handle will be private to the current transaction until
      * the transaction is successfully committed.

"the handle being private" only refers to the first mdb_dbi_open.
Once this transaction is committed, one doesn't have to call this again in subsequent concurrent transactions and can use this handle.
And then this handle won't be private at all.

Did I get it right?


Yes. I do this exactly that way as part of my initial setup of my application. Once the transaction is committed, I use the returned handles setup from whatever thread that needs to access the respective database. I never call mdb_dbi_open again after the setup.

Regards,

Klaus