284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
0))
;; The watchdog is to keep an eye on things like db sync etc.
;;
(define *watchdog*
(make-thread
(lambda ()
(let loop ()
(thread-sleep! 5) ;; five second resolution is only a minor burden and should be tolerable
;; sync for filesystem local db writes
;;
(let ((start-time (current-seconds)))
(mutex-lock! *db-multi-sync-mutex*)
(for-each
(lambda (run-id)
(let ((last-write (hash-table-ref/default *db-local-sync* run-id 0)))
|
>
<
<
|
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
|
0))
;; The watchdog is to keep an eye on things like db sync etc.
;;
(define *watchdog*
(make-thread
(lambda ()
(thread-sleep! 0.5) ;; half second delay for startup
(let loop ()
;; sync for filesystem local db writes
;;
(let ((start-time (current-seconds)))
(mutex-lock! *db-multi-sync-mutex*)
(for-each
(lambda (run-id)
(let ((last-write (hash-table-ref/default *db-local-sync* run-id 0)))
|
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
(hash-table-delete! *db-local-sync* run-id)))))
(hash-table-keys *db-local-sync*))
(mutex-unlock! *db-multi-sync-mutex*))
;; keep going unless time to exit
;;
(if (not *time-to-exit*)
(loop))))
"Watchdog thread"))
(thread-start! *watchdog*)
(define (std-exit-procedure)
(rmt:print-db-stats)
(let ((run-ids (hash-table-keys *db-local-sync*)))
|
>
>
|
|
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
(hash-table-delete! *db-local-sync* run-id)))))
(hash-table-keys *db-local-sync*))
(mutex-unlock! *db-multi-sync-mutex*))
;; keep going unless time to exit
;;
(if (not *time-to-exit*)
(begin
(thread-sleep! 5) ;; five second resolution is only a minor burden and should be tolerable
(loop)))))
"Watchdog thread"))
(thread-start! *watchdog*)
(define (std-exit-procedure)
(rmt:print-db-stats)
(let ((run-ids (hash-table-keys *db-local-sync*)))
|