From 0d23a6d374340f3f9a3b035f960abd39447e11c3 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 24 Jan 2020 18:25:47 +0000 Subject: 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. --- tests/database.scm | 2 +- tests/http.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') 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" -- cgit v1.2.3