Skip to content

Concurrency and Locks

Zohaib Sibte Hassan edited this page Mar 7, 2016 · 1 revision

Design Philosophy

LevelDBWinRT is supposed to do nothing extra other than giving you direct interface to LevelDB. Rephrasing original LevelDB documentation, a database may only be opened by one process at a time. The LevelDB implementation acquires a lock from the operating system to prevent misuse. Within a single process, the same DB object may be safely shared by multiple concurrent threads i.e. different threads may write into or fetch iterators or call Get on the same database without any external synchronization (the LevelDB implementation will automatically do the required synchronization). However other objects (like Iterator and WriteBatch) may require external synchronization. If two threads share such an object, they must protect access to it using their own

It's up-to programmer to implement appropriate locking when using any of the objects that may cause contention.

No Async task methods

One can really implement simple extension methods on DB class to have methods like GetAsync. It's not implemented in library out of the box; keep in mind it's a bare-bone wrapper. It's not trying to do anything extra at all!