summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-02-05 10:11:54 +1100
committerGitHub <noreply@github.com>2024-02-05 00:11:54 +0100
commit0f7f98795129f3f6bef51d08da9accca5e9ca9cc (patch)
treecb71c1358b9235a7f5098623750712e3de693277 /ext
parent07a94984e1e3ca24dcaf114ac5ff82c8c3510894 (diff)
feat(unstable): `Deno.FsFile.lock[Sync]()` and `Deno.FsFile.unlock[Sync]()` (#22235)
Closes #22178.
Diffstat (limited to 'ext')
-rw-r--r--ext/fs/30_fs.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js
index 9343b6ec4..aa7f345e5 100644
--- a/ext/fs/30_fs.js
+++ b/ext/fs/30_fs.js
@@ -766,6 +766,22 @@ class FsFile {
futimeSync(this.#rid, atime, mtime);
}
+ lockSync(exclusive = false) {
+ op_fs_flock_sync(this.#rid, exclusive);
+ }
+
+ async lock(exclusive = false) {
+ await op_fs_flock_async(this.#rid, exclusive);
+ }
+
+ unlockSync() {
+ op_fs_funlock_sync(this.#rid);
+ }
+
+ async unlock() {
+ await op_fs_funlock_async(this.#rid);
+ }
+
[SymbolDispose]() {
core.tryClose(this.#rid);
}