+
+void *
+ldbm_cache_sync_daemon(
+ void *be_ptr
+)
+{
+ Backend *be = (Backend *)be_ptr;
+ struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+#ifdef NEW_LOGGING
+ LDAP_LOG ( CACHE, ARGS, "ldbm_cache_sync_daemon:"
+ " synchronizer starting for %s\n", li->li_directory, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "synchronizer starting for %s\n", li->li_directory, 0, 0 );
+#endif
+
+ while (!li->li_dbshutdown) {
+ int i = li->li_dbsyncwaitn;
+
+ sleep( li->li_dbsyncfreq );
+
+ while (i && ldap_pvt_thread_pool_backload(&connection_pool) != 0) {
+#ifdef NEW_LOGGING
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync_daemon:"
+ " delay syncing %s\n", li->li_directory, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "delay syncing %s\n", li->li_directory, 0, 0 );
+#endif
+ sleep(li->li_dbsyncwaitinterval);
+ i--;
+ }
+
+ if (!li->li_dbshutdown) {
+#ifdef NEW_LOGGING
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync_daemon:"
+ " syncing %s\n", li->li_directory, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, "syncing %s\n", li->li_directory, 0, 0 );
+#endif
+ ldbm_cache_sync( be );
+ }
+ }
+
+#ifdef NEW_LOGGING
+ LDAP_LOG ( CACHE, DETAIL1, "ldbm_cache_sync_daemon:"
+ " synchronizer stopping\n", 0, 0, 0);
+#else
+ Debug( LDAP_DEBUG_ANY, "synchronizer stopping\n", 0, 0, 0 );
+#endif
+
+ return NULL;
+}