comparison src/c/driver.c @ 700:db6ab16cd8f3

Initialize contexts a little more vigorously
author Adam Chlipala <adamc@hcoop.net>
date Sun, 05 Apr 2009 12:05:19 -0400
parents 9b29ce0babb8
children a5d8b470d7ca
comparison
equal deleted inserted replaced
699:4e260887d8f2 700:db6ab16cd8f3
304 exit(0); 304 exit(0);
305 } 305 }
306 306
307 static void initialize() { 307 static void initialize() {
308 uw_context ctx = new_context(); 308 uw_context ctx = new_context();
309 failure_kind fk;
309 310
310 if (!ctx) 311 if (!ctx)
311 exit(1); 312 exit(1);
312 313
313 if (uw_initialize(ctx) != SUCCESS) { 314 for (fk = uw_initialize(ctx); fk == UNLIMITED_RETRY; fk = uw_initialize(ctx)) {
314 printf("Failed to initialize database!\n"); 315 printf("Unlimited retry during init: %s\n", uw_error_message(ctx));
316 uw_db_rollback(ctx);
317 uw_reset(ctx);
318 }
319
320 if (fk != SUCCESS) {
321 printf("Failed to initialize database! %s\n", uw_error_message(ctx));
315 uw_db_rollback(ctx); 322 uw_db_rollback(ctx);
316 exit(1); 323 exit(1);
317 } 324 }
318 325
319 uw_free(ctx); 326 uw_free(ctx);