On Wed, Dec 10, 2014 at 7:21 PM, Howard Chu hyc@symas.com wrote:
Interesting. The downside of your semaphore suggestion on Windows is that means any thread can also unlock it, regardless of current owner. This is also detected as an error in POSIX mutexes.
Yeah, if we used semaphores, we might also wish to track transaction-object IDs (as a replacement for thread IDs) so we can perform our own safety checking. Gaining more control over the mutex model could be useful in other ways, e.g. supporting high priority writes.
OTOH, I want to move on to using LMDB, rather than working on it. My Haskell bindings to LMDB [1] are now in a usable condition, albeit only at the lowest level. You can add it to the list. :)
[1] http://hackage.haskell.org/package/lmdb-0.2.0
LMDB is documented to be a single-writer design. I don't see any sane way for us to support M:N threading models ourselves; not portably to all the possible runtimes out there. I suggest you wrap your own mutex mechanism around your wrapper for mdb_txn_begin().
That was my conclusion, too. And it's what I'm doing at the moment.
Best,
Dave