| 1307 | } |
| 1308 | |
| 1309 | static bool main_version_cohort_close(cbm_version_cohort_lease_t **lease, |
| 1310 | cbm_version_cohort_manager_t **manager) { |
| 1311 | bool ok = true; |
| 1312 | uint64_t deadline = main_deadline_after(MAIN_COORDINATION_CLEANUP_MS); |
| 1313 | while (lease && *lease) { |
| 1314 | cbm_private_file_lock_status_t status = cbm_version_cohort_lease_release(lease); |
| 1315 | if (status != CBM_PRIVATE_FILE_LOCK_OK) { |
| 1316 | ok = false; |
| 1317 | } |
| 1318 | if (*lease) { |
| 1319 | if (cbm_now_ms() >= deadline) { |
| 1320 | main_coordination_cleanup_fail_stop("cohort_lease_cleanup"); |
| 1321 | } |
| 1322 | cbm_usleep(1000); |
| 1323 | } |
| 1324 | } |
| 1325 | deadline = main_deadline_after(MAIN_COORDINATION_CLEANUP_MS); |
| 1326 | while (manager && *manager) { |
| 1327 | cbm_private_file_lock_status_t status = cbm_version_cohort_manager_free(manager); |
| 1328 | if (status != CBM_PRIVATE_FILE_LOCK_OK) { |
| 1329 | ok = false; |
| 1330 | } |
| 1331 | if (*manager) { |
| 1332 | if (cbm_now_ms() >= deadline) { |
| 1333 | main_coordination_cleanup_fail_stop("cohort_manager_cleanup"); |
| 1334 | } |
| 1335 | cbm_usleep(1000); |
| 1336 | } |
| 1337 | } |
| 1338 | return ok; |
| 1339 | } |
| 1340 | |
| 1341 | static bool main_project_lock_manager_close(cbm_project_lock_manager_t **manager) { |
| 1342 | bool ok = true; |
no test coverage detected