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

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

Issue 13704003: Reapply "Add a sleep function to dart:io" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added "hide sleep" where needed Created 7 years, 8 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
Index: sdk/lib/io/process.dart
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index e3c62e977fe925f71d84a88d342c8902da4b1163..8ceb41d9e7d16a61d188b22901800cdfadccc91d 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -9,6 +9,7 @@ part of dart.io;
class _ProcessUtils {
external static _exit(int status);
external static _setExitCode(int status);
+ external static _sleep(int millis);
}
/**
@@ -39,6 +40,16 @@ set exitCode(int status) {
}
/**
+ * Sleep for the duration specified in [duration].
+ *
+ * Use this with care, as no asynchronous operations can be processed
+ * in a isolate while it is blocked in a [sleep] call.
+ */
+void sleep(Duration duration) {
+ _ProcessUtils._sleep(duration.inMilliseconds);
+}
+
+/**
* [Process] is used to start new processes using the static
* [start] and [run] methods.
*/

Powered by Google App Engine
This is Rietveld 408576698