Sam Dave wrote: > Hi, > > I'm interested in understanding these functions better. These are not > criticisms.. since these functions are called rarely, I have no problem > synchronizing > them. I ask only for curiosity's sake.
Everything in LMDB is defined within the context of a single environment. That should already be clear from the documentation. The constraints you reference below only apply within a single environment. Separate environments are completely independent of each other. > > * mdb_env_close: "Only a single thread may call this function." Why can't > different environments (separate files/dirs on disk) be closed from different > threads? > > * mdb_dbi_close: "Handles should only be closed by a single thread." Why > can't at least databases on different environments (separate files/dirs on > disk) be > closed from different threads? > > * mdb_dbi_open: "This function must not be called from multiple concurrent > transactions in the same process." Why can't this function be called from > different > threads to open at least databases on different environments (separate > files/dirs on disk)? > > What are the reasons for these limitations, under the hood? Could these > functions have been designed in a different way, to allow for more > multithreading > (again, I'm not asking for this, I'm just curious). > > - Sam -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
