16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
+
+
|
(import (prefix sqlite3 sqlite3:))
(import (prefix base64 base64:))
(declare (unit common))
(include "common_records.scm")
(include "thunk-utils.scm")
;; (require-library margs)
;; (include "margs.scm")
;; (define old-exit exit)
;;
;; (define (exit . code)
|
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
|
(mutex-lock! *context-mutex*)
(let ((cxt (hash-table-ref/default *contexts* toppath #f)))
(if (not cxt)
(set! cxt (let ((x (make-cxt)))(hash-table-set! *contexts* toppath x) x)))
(let ((cxt-mutex (cxt-mutex cxt)))
(mutex-unlock! *context-mutex*)
(mutex-lock! cxt-mutex)
;; here we guard proc with exception handler so
;; no matter how proc succeeds or fails,
;; the cxt-mutex will be unlocked afterward.
(let* ((EXCEPTION-SYMBOL (gensym)) ;; use a generated symbol
(guarded-proc ;; to avoid collision
(lambda args
(let ((res (proc cxt)))
(mutex-unlock! cxt-mutex)
res))))
(let* ((res (condition-case
(apply proc args)
[x () (cons EXCEPTION-SYMBOL x)])))
(mutex-unlock! cxt-mutex)
(if (and (pair? res) (eq? (car res) EXCEPTION))
(abort (cdr res))
res)))))
(guarded-proc cxt)))))
(define *db-keys* #f)
(define *configinfo* #f) ;; raw results from setup, includes toppath and table from megatest.config
(define *runconfigdat* #f) ;; run configs data
(define *configdat* #f) ;; megatest.config data
(define *configstatus* #f) ;; status of data; 'fulldata : all processing done, #f : no data yet, 'partialdata : partial read done
|