696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
|
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
|
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
|
(delay-loop (+ count 1))))
(if (not *time-to-exit*) (loop))))
(if (common:low-noise-print 30)
(debug:print-info 0 *default-log-port* "Exiting watchdog timer, *time-to-exit* = " *time-to-exit*" pid="(current-process-id)" this-wd-num="this-wd-num)))))))
;; TODO: for multiple areas, we will have multiple watchdogs; and multiple threads to manage
(define (common:watchdog)
;;#t)
(BB> "common:watchdog entered.")
(let ((dbstruct (db:setup)))
(if (dbr:dbstruct-read-only dbstruct)
(common:readonly-watchdog dbstruct)
(common:writable-watchdog dbstruct))))
(let ((dbstruct (db:setup)))
(cond
((dbr:dbstruct-read-only dbstruct)
(BB> "loading read-only watchdog")
common:readonly-watchdog dbstruct)
(else
(BB> "loading writable-watchdog.")
(common:writable-watchdog dbstruct))))
(BB> "watchdog done.");;)
)
(define (std-exit-procedure)
(on-exit (lambda () 0))
;;(BB> "std-exit-procedure called; *time-to-exit*="*time-to-exit*)
(let ((no-hurry (if *time-to-exit* ;; hurry up
#f
|