Skip to content

Commit 600e2b6

Browse files
committed
Support robust mutexes/locks. Add mdb_mutex_t etc.
1 parent 3a71450 commit 600e2b6

File tree

2 files changed

+174
-65
lines changed

2 files changed

+174
-65
lines changed

libraries/liblmdb/lmdb.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@
4949
* stale locks can block further operation.
5050
*
5151
* Fix: Check for stale readers periodically, using the
52-
* #mdb_reader_check function or the \ref mdb_stat_1 "mdb_stat" tool. Or just
53-
* make all programs using the database close it; the lockfile
54-
* is always reset on first open of the environment.
52+
* #mdb_reader_check function or the \ref mdb_stat_1 "mdb_stat" tool.
53+
* Stale writers will be cleared automatically on some systems:
54+
* - Windows - automatic
55+
* - Linux, systems using POSIX mutexes with Robust option - automatic
56+
* - not on BSD, systems using POSIX semaphores.
57+
* Otherwise just make all programs using the database close it;
58+
* the lockfile is always reset on first open of the environment.
5559
*
5660
* - On BSD systems or others configured with MDB_USE_POSIX_SEM,
5761
* startup can fail due to semaphores owned by another userid.
@@ -106,6 +110,9 @@
106110
* for stale readers is performed or the lockfile is reset,
107111
* since the process may not remove it from the lockfile.
108112
*
113+
* This does not apply to write transactions if the system clears
114+
* stale writers, see above.
115+
*
109116
* - If you do that anyway, do a periodic check for stale readers. Or
110117
* close the environment once in a while, so the lockfile can get reset.
111118
*
@@ -391,7 +398,7 @@ typedef enum MDB_cursor_op {
391398
#define MDB_PAGE_NOTFOUND (-30797)
392399
/** Located page was wrong type */
393400
#define MDB_CORRUPTED (-30796)
394-
/** Update of meta page failed, probably I/O error */
401+
/** Update of meta page failed or environment had fatal error */
395402
#define MDB_PANIC (-30795)
396403
/** Environment version mismatch */
397404
#define MDB_VERSION_MISMATCH (-30794)

0 commit comments

Comments
 (0)