mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 01:14:12 +08:00
mdbx: clarify mdbx_env_set_flags().
Change-Id: I45d9af8cbaf9710e78c93d157c70fc2d305f3100
This commit is contained in:
parent
87f8c01ac4
commit
91ee841fc2
12
mdbx.h
12
mdbx.h
@ -1717,11 +1717,15 @@ LIBMDBX_API int mdbx_env_close(MDBX_env *env);
|
||||
/* Set environment flags.
|
||||
*
|
||||
* This may be used to set some flags in addition to those from
|
||||
* mdbx_env_open(), or to unset these flags. If several threads
|
||||
* change the flags at the same time, the result is undefined.
|
||||
* mdbx_env_open(), or to unset these flags.
|
||||
*
|
||||
* [in] env An environment handle returned by mdbx_env_create()
|
||||
* [in] flags The flags to change, bitwise OR'ed together
|
||||
* NOTE: In contrast to LMDB, the MDBX serialize threads via mutex while
|
||||
* changing the flags. Therefore this function will be blocked while a write
|
||||
* transaction running by other thread, or MDBX_BUSY will be returned if
|
||||
* function called within a write transaction.
|
||||
*
|
||||
* [in] env An environment handle returned by mdbx_env_create().
|
||||
* [in] flags The flags to change, bitwise OR'ed together.
|
||||
* [in] onoff A non-zero value sets the flags, zero clears them.
|
||||
*
|
||||
* Returns A non-zero error value on failure and 0 on success, some
|
||||
|
@ -12806,7 +12806,13 @@ int __cold mdbx_env_set_flags(MDBX_env *env, unsigned flags, int onoff) {
|
||||
return MDBX_EBADSIGN;
|
||||
|
||||
if (unlikely(flags & ~CHANGEABLE))
|
||||
return MDBX_EINVAL;
|
||||
return MDBX_EPERM;
|
||||
|
||||
if (unlikely(env->me_flags & MDBX_RDONLY))
|
||||
return MDBX_EACCESS;
|
||||
|
||||
if (unlikely(env->me_txn0->mt_owner == mdbx_thread_self()))
|
||||
return MDBX_BUSY;
|
||||
|
||||
int rc = mdbx_txn_lock(env, false);
|
||||
if (unlikely(rc))
|
||||
|
Loading…
x
Reference in New Issue
Block a user