diff 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
line wrap: on
line diff
--- a/src/c/driver.c	Sun Apr 05 11:48:55 2009 -0400
+++ b/src/c/driver.c	Sun Apr 05 12:05:19 2009 -0400
@@ -306,12 +306,19 @@
 
 static void initialize() {
   uw_context ctx = new_context();
+  failure_kind fk;
 
   if (!ctx)
     exit(1);
 
-  if (uw_initialize(ctx) != SUCCESS) {
-    printf("Failed to initialize database!\n");
+  for (fk = uw_initialize(ctx); fk == UNLIMITED_RETRY; fk = uw_initialize(ctx)) {
+    printf("Unlimited retry during init: %s\n", uw_error_message(ctx));
+    uw_db_rollback(ctx);
+    uw_reset(ctx);
+  }
+
+  if (fk != SUCCESS) {
+    printf("Failed to initialize database!  %s\n", uw_error_message(ctx));
     uw_db_rollback(ctx);
     exit(1);
   }