MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / hold_config_lock

Function hold_config_lock

tests/test_runtime_settings.c:418–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418static bool hold_config_lock(const char *cache, const char *lock_sql) {
419 char path[512];
420 snprintf(path, sizeof(path), "%s/_config.db", cache);
421 g_lock_waits = 0;
422 if (sqlite3_open(path, &g_lock_holder) != SQLITE_OK ||
423 sqlite3_exec(g_lock_holder, lock_sql, NULL, NULL, NULL) != SQLITE_OK) {
424 sqlite3_close(g_lock_holder);
425 g_lock_holder = NULL;
426 return false;
427 }
428 g_lock_saved_level = cbm_log_get_level();
429 if (g_lock_saved_level > CBM_LOG_WARN)
430 cbm_log_set_level(CBM_LOG_WARN);
431 cbm_log_set_sink(release_holder_on_wait);
432 return true;
433}
434
435static void release_config_lock(void) {
436 cbm_log_set_sink(NULL);

Callers 1

Calls 3

cbm_log_get_levelFunction · 0.85
cbm_log_set_levelFunction · 0.85
cbm_log_set_sinkFunction · 0.85

Tested by

no test coverage detected