summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-01-24 18:25:47 +0000
committerChristopher Baines <mail@cbaines.net>2020-01-25 22:32:09 +0000
commit0d23a6d374340f3f9a3b035f960abd39447e11c3 (patch)
treedb7f97dcb1f60ce43781c737a8f53afcbf9db933 /tests
parentfa412cdb5985ec4199f89510d8d8cde9b7664e2d (diff)
downloadcuirass-0d23a6d374340f3f9a3b035f960abd39447e11c3.tar
cuirass-0d23a6d374340f3f9a3b035f960abd39447e11c3.tar.gz
utils: Change critical section terminology to worker threads.
As far as I'm aware, it's necessary to use a separate thread for interacting with SQLite as one of the threads used for fibers will be blocked while the SQLite query is running. This doesn't mean all queries have to be executed one at a time though, providing the queries are executed outside the threads used by fibers, and a single connection isn't used in multiple threads. These changes start to move in this direction, first by just changing the terminology. * src/cuirass/base.scm (clear-build-queue, cancel-old-builds): Change with-db-critical-section to with-db-worker-thread. * src/cuirass/database.scm (with-db-critical-section): Rename syntax rule to with-db-worker-thread. (db-add-input, db-add-checkout, db-add-specification, db-remove-specification, db-get-inputs, db-get-specification, db-add-evaluation, db-set-evaluations-done, db-set-evaluation-done, db-add-derivation-output, db-add-build, db-update-build-status!, db-get-output, db-get-outputs, db-get-builds-by-search, db-get-builds, db-get-build derivation-or-id, db-add-event, db-get-events, db-delete-events-with-ids-<=-to, db-get-pending-derivations, db-get-checkouts, db-get-evaluations, db-get-evaluations-build-summary, db-get-evaluations-id-max, db-get-evaluation-summary, db-get-builds-query-min, db-get-builds-query-max, db-get-builds-min, db-get-builds-max, db-get-evaluation-specification): Change from using with-db-critical-section to with-db-worker-thread. (with-database): Change syntax rule to use make-worker-thread-channel, renaming from make-critical-section. * src/cuirass/utils.scm (%critical-section-args): Rename parameter to %worker-thread-args. (make-critical-section): Rename to make-worker-thread-channel, and adjust parameter and docstring. (call-with-critical-section): Rename to call-with-worker-thread and adjust parameter. (with-critical-section): Rename to with-worker-thread, and adjust to call call-with-worker-thread. * tests/database.scm (db-init): Use make-worker-thread-channel rather than make-critical-section. * tests/http.scm (db-init): Use make-worker-thread-channel rather than make-critical-section.
Diffstat (limited to 'tests')
-rw-r--r--tests/database.scm2
-rw-r--r--tests/http.scm2
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/database.scm b/tests/database.scm
index d9dfe13..271f166 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -87,7 +87,7 @@
(test-assert "db-init"
(begin
(%db (db-init database-name))
- (%db-channel (make-critical-section (%db)))
+ (%db-channel (make-worker-thread-channel (%db)))
#t))
(test-assert "sqlite-exec"
diff --git a/tests/http.scm b/tests/http.scm
index b21fa17..337a775 100644
--- a/tests/http.scm
+++ b/tests/http.scm
@@ -108,7 +108,7 @@
(test-assert "db-init"
(begin
(%db (db-init database-name))
- (%db-channel (make-critical-section (%db)))
+ (%db-channel (make-worker-thread-channel (%db)))
#t))
(test-assert "cuirass-run"