summaryrefslogtreecommitdiff
path: root/common/lock.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/lock.js')
-rw-r--r--common/lock.js17
1 files changed, 3 insertions, 14 deletions
diff --git a/common/lock.js b/common/lock.js
index d136469..56dad4f 100644
--- a/common/lock.js
+++ b/common/lock.js
@@ -55,9 +55,7 @@
* in a promise.
*/
-function make_lock() {
- return {free: true, queue: []};
-}
+#EXPORT () => ({free: true, queue: []}) AS make_lock
function _lock(lock, cb) {
if (lock.free) {
@@ -68,9 +66,7 @@ function _lock(lock, cb) {
}
}
-function lock(lock) {
- return new Promise((resolve, reject) => _lock(lock, resolve));
-}
+#EXPORT lock => new Promise(resolve => _lock(lock, resolve)) AS lock
function unlock(lock) {
if (lock.free)
@@ -84,11 +80,4 @@ function unlock(lock) {
setTimeout(cb);
}
}
-
-/*
- * EXPORTS_START
- * EXPORT make_lock
- * EXPORT lock
- * EXPORT unlock
- * EXPORTS_END
- */
+#EXPORT unlock