+ // on slot wraparound, check census
+ // count and increment safe level
+
+ cnt = bt->latchmgr->cache[bt->latchmgr->safelevel];
+
+ if( !slot ) {
+ if( cnt < bt->latchmgr->latchtotal / 10 )
+#ifdef unix
+ __sync_fetch_and_add(&bt->latchmgr->safelevel, 1);
+#else
+ _InterlockedIncrement (&bt->latchmgr->safelevel);
+#endif
+ continue;
+ }
+
+ latch = bt->latchsets + slot;