[fdb] Add the lock in database init function.
This commit is contained in:
parent
2dea1b2b88
commit
7e91b05483
|
@ -1754,6 +1754,9 @@ fdb_err_t fdb_kvdb_init(fdb_kvdb_t db, const char *name, const char *path, struc
|
|||
/* must be aligned with write granularity */
|
||||
FDB_ASSERT((FDB_STR_KV_VALUE_MAX_SIZE * 8) % FDB_WRITE_GRAN == 0);
|
||||
|
||||
/* lock the KVDB */
|
||||
db_lock(db);
|
||||
|
||||
result = _fdb_init_ex((fdb_db_t) db, name, path, FDB_DB_TYPE_KV, user_data);
|
||||
if (result != FDB_NO_ERR) {
|
||||
goto __exit;
|
||||
|
@ -1806,6 +1809,9 @@ __exit:
|
|||
|
||||
_fdb_init_finish((fdb_db_t)db, result);
|
||||
|
||||
/* unlock the KVDB */
|
||||
db_unlock(db);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -927,6 +927,9 @@ fdb_err_t fdb_tsdb_init(fdb_tsdb_t db, const char *name, const char *path, fdb_g
|
|||
|
||||
FDB_ASSERT(get_time);
|
||||
|
||||
/* lock the TSDB */
|
||||
db_lock(db);
|
||||
|
||||
result = _fdb_init_ex((fdb_db_t)db, name, path, FDB_DB_TYPE_TS, user_data);
|
||||
if (result != FDB_NO_ERR) {
|
||||
goto __exit;
|
||||
|
@ -996,6 +999,9 @@ __exit:
|
|||
|
||||
_fdb_init_finish((fdb_db_t)db, result);
|
||||
|
||||
/* unlock the TSDB */
|
||||
db_unlock(db);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue