Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: sdk/lib/io/file.dart

Issue 2050413002: Adds blocking file locks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update docs and CHANGELOG Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_win.cc ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file.dart
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index 4ac4486f6795ecda472864baa1e090da77d8b8da..92d144f941e48ca2e05e4ad0251c053549d90366 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -52,7 +52,11 @@ enum FileLock {
/// Shared file lock.
SHARED,
/// Exclusive file lock.
- EXCLUSIVE
+ EXCLUSIVE,
+ /// Blocking shared file lock.
+ BLOCKING_SHARED,
+ /// Blocking exclusive file lock.
+ BLOCKING_EXCLUSIVE,
}
/**
@@ -735,6 +739,11 @@ abstract class RandomAccessFile {
*
* To obtain an exclusive lock on a file it must be opened for writing.
*
+ * If [mode] is [FileLock.EXCLUSIVE] or [FileLock.SHARED], an error is
+ * signaled if the lock cannot be obtained. If [mode] is
+ * [FileLock.BLOCKING_EXCLUSIVE] or [FileLock.BLOCKING_SHARED], the
+ * returned [Future] is resolved only when the lock has been obtained.
+ *
siva 2016/06/13 15:56:08 This operation is not synchronous, should we allow
zra 2016/06/13 16:03:33 This call is implemented as a request sent to the
Søren Gjesse 2016/06/13 16:05:09 The blocking I/O call is dispatched on the "native
* *NOTE* file locking does have slight differences in behavior across
* platforms:
*
@@ -768,6 +777,11 @@ abstract class RandomAccessFile {
*
* To obtain an exclusive lock on a file it must be opened for writing.
*
+ * If [mode] is [FileLock.EXCLUSIVE] or [FileLock.SHARED], an exception is
+ * thrown if the lock cannot be obtained. If [mode] is
+ * [FileLock.BLOCKING_EXCLUSIVE] or [FileLock.BLOCKING_SHARED], the
+ * call returns only after the lock has been obtained.
+ *
* *NOTE* file locking does have slight differences in behavior across
* platforms:
*
« no previous file with comments | « runtime/bin/file_win.cc ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698