aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/indexeddb.js4
-rw-r--r--common/lock.js13
2 files changed, 14 insertions, 3 deletions
diff --git a/common/indexeddb.js b/common/indexeddb.js
index f9c407a..a18c9be 100644
--- a/common/indexeddb.js
+++ b/common/indexeddb.js
@@ -313,8 +313,8 @@ async function _save_items(resources, mappings, context)
/*
* Save given definition of a resource/mapping to IndexedDB. If the definition
* (passed as `item`) references files that are not already present in
- * IndexedDB, those files should be present as values of the `files_sha256`
- * object with keys being of the form `sha256-<file's-sha256-sum>`.
+ * IndexedDB, those files should be provided as values of the `files' object
+ * used to create the transaction context.
*
* context should be one returned from start_items_transaction() and should be
* later passed to finalize_transaction() so that files depended on are added to
diff --git a/common/lock.js b/common/lock.js
index 8dd2f5b..f577481 100644
--- a/common/lock.js
+++ b/common/lock.js
@@ -68,9 +68,20 @@ function _lock(lock, cb) {
#EXPORT lock => new Promise(resolve => _lock(lock, resolve)) AS lock
+function try_lock(lock)
+{
+ if (lock.free) {
+ lock.free = false;
+ return true;
+ }
+
+ return false;
+}
+#EXPORT try_lock
+
function unlock(lock) {
if (lock.free)
- throw new Error("Attempting to release a free lock");
+ throw new Exception("Attempting to release a free lock");
if (lock.queue.length === 0) {
lock.free = true;
gnu: ode: Update to 0.16.5....Nicolas Goaziou 2024-04-03gnu: godot: Update to 4.2.1....John Kehayias