本文整理汇总了C++中DB_ENV::get_lk_max_locks方法的典型用法代码示例。如果您正苦于以下问题:C++ DB_ENV::get_lk_max_locks方法的具体用法?C++ DB_ENV::get_lk_max_locks怎么用?C++ DB_ENV::get_lk_max_locks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_ENV
的用法示例。
在下文中一共展示了DB_ENV::get_lk_max_locks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestLockMaxLocks
int TestLockMaxLocks(CuTest *ct) {
DB_ENV *dbenv;
u_int32_t v;
dbenv = NULL;
/* lk_max_locks: NOT reset at run-time. */
ENV
CuAssertTrue(ct, dbenv->set_lk_max_locks(dbenv, 1037) == 0);
CuAssertTrue(ct, dbenv->open(dbenv,
TEST_ENV, DB_CREATE | DB_INIT_LOCK, 0666) == 0);
CuAssertTrue(ct, dbenv->get_lk_max_locks(dbenv, &v) == 0);
CuAssertTrue(ct, v == 1037);
ENV
CuAssertTrue(ct, dbenv->set_lk_max_locks(dbenv, 1063) == 0);
CuAssertTrue(ct, dbenv->open(dbenv, TEST_ENV, DB_JOINENV, 0666) == 0);
CuAssertTrue(ct, dbenv->get_lk_max_locks(dbenv, &v) == 0);
CuAssertTrue(ct, v == 1037);
return (0);
}
示例2: sizeof
//.........这里部分代码省略.........
"TESTDIR", DB_CREATE | DB_INIT_LOCK, 0666) == 0);
assert(dbenv->get_lk_conflicts(dbenv, &lk_conflicts, &lk_modes) == 0);
assert(lk_conflicts[0] == 'a');
assert(lk_modes == 6);
ENV
memset(conflicts, 'b', sizeof(conflicts));
nmodes = 8;
assert(dbenv->set_lk_conflicts(dbenv, conflicts, nmodes) == 0);
assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
assert(dbenv->get_lk_conflicts(dbenv, &lk_conflicts, &lk_modes) == 0);
assert(lk_conflicts[0] == 'a');
assert(lk_modes == 6);
/* lk_detect: NOT reset at run-time. */
system("rm -rf TESTDIR; mkdir TESTDIR");
ENV
assert(dbenv->set_lk_detect(dbenv, DB_LOCK_MAXLOCKS) == 0);
assert(dbenv->open(dbenv,
"TESTDIR", DB_CREATE | DB_INIT_LOCK, 0666) == 0);
assert(dbenv->get_lk_detect(dbenv, &v) == 0);
assert(v == DB_LOCK_MAXLOCKS);
ENV
assert(dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT) == 0);
assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
assert(dbenv->get_lk_detect(dbenv, &v) == 0);
assert(v == DB_LOCK_MAXLOCKS);
/* lk_max_locks: NOT reset at run-time. */
system("rm -rf TESTDIR; mkdir TESTDIR");
ENV
assert(dbenv->set_lk_max_locks(dbenv, 37) == 0);
assert(dbenv->open(dbenv,
"TESTDIR", DB_CREATE | DB_INIT_LOCK, 0666) == 0);
assert(dbenv->get_lk_max_locks(dbenv, &v) == 0);
assert(v == 37);
ENV
assert(dbenv->set_lk_max_locks(dbenv, 63) == 0);
assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
assert(dbenv->get_lk_max_locks(dbenv, &v) == 0);
assert(v == 37);
/* lk_max_lockers: NOT reset at run-time. */
system("rm -rf TESTDIR; mkdir TESTDIR");
ENV
assert(dbenv->set_lk_max_lockers(dbenv, 37) == 0);
assert(dbenv->open(dbenv,
"TESTDIR", DB_CREATE | DB_INIT_LOCK, 0666) == 0);
assert(dbenv->get_lk_max_lockers(dbenv, &v) == 0);
assert(v == 37);
ENV
assert(dbenv->set_lk_max_lockers(dbenv, 63) == 0);
assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
assert(dbenv->get_lk_max_lockers(dbenv, &v) == 0);
assert(v == 37);
/* lk_max_objects: NOT reset at run-time. */
system("rm -rf TESTDIR; mkdir TESTDIR");
ENV
assert(dbenv->set_lk_max_objects(dbenv, 37) == 0);
assert(dbenv->open(dbenv,
"TESTDIR", DB_CREATE | DB_INIT_LOCK, 0666) == 0);
assert(dbenv->get_lk_max_objects(dbenv, &v) == 0);
assert(v == 37);
ENV
assert(dbenv->set_lk_max_objects(dbenv, 63) == 0);
assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);