Coder Social home page Coder Social logo

Allow copying of lmdb::dbi instances about lmdbxx HOT 2 OPEN

drycpp avatar drycpp commented on July 21, 2024
Allow copying of lmdb::dbi instances

from lmdbxx.

Comments (2)

landtuna avatar landtuna commented on July 21, 2024

I think this issue makes the library hard to use in a multithreaded environment. The documentation for lmdb says of mdb_dbi_open, "After a successful commit the handle will reside in the shared environment, and may be used by other transactions." It also says, "This function must not be called from multiple concurrent transactions in the same process."

Together, I take it to mean that the main process should open a database once (inside a transaction) and then pass the dbi handle to each of the threads it spawns. Without being able to copy an lmdb::dbi, I think the only way to do this is to pass the underlying handle around.

from lmdbxx.

hoytech avatar hoytech commented on July 21, 2024

In my fork of this library (https://github.com/hoytech/lmdbxx) I have made lmdb::dbi instances copyable. I can't think of any situation where copying the dbi would cause a bug, and in many cases being able to copy dbis or pass them by value simplifies application code.

from lmdbxx.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.