@@ -69,7 +69,32 @@ class _WaitForUtils {
69
69
* Suspends the stack, runs microtasks, and handles incoming events until
70
70
* [future] completes.
71
71
*
72
- * WARNING: EXPERIMENTAL. USE AT YOUR OWN RISK.
72
+ * ## Deprecation notice
73
+ *
74
+ * The `waitFor` feature is deprecated.
75
+ * The feature was intended to solve a particular problem for existing code,
76
+ * a problem introduced by a breaking change to the platform libraries.
77
+ * The `waitFor` function is not suitable for general use.
78
+ * The feature has shortcomings that can affect other code
79
+ * running in the same isolate, including:
80
+ * * A function call that looks synchronous may cause other asynchronous
81
+ * events to run before it returns.
82
+ * This is something synchronous code can usually assume not to happen,
83
+ * and some code may have been written to take advantage of that
84
+ * assumed behavior. Such code can fail in unexpected ways.
85
+ * * Multiple nested calls to `waitFor` may block each other
86
+ * since the most recent call always needs to complete
87
+ * before any other call can complete.
88
+ * Judicious use of `waitFor` is necessary to avoid unexpected deadlocks
89
+ * which wouldn't happen if using `await` instead.
90
+ * If more than one library in the same program is using `waitFor`,
91
+ * then it's hard to avoid or control whether such blocking will happen.
92
+ *
93
+ * The feature is not actively maintained.
94
+ * It will remain as-is to support the original problem it was added to solve,
95
+ * at least until that problem can be solved in some other way.
96
+ *
97
+ * ## Call semantics
73
98
*
74
99
* This call does the following:
75
100
* - While [future] is not completed:
@@ -111,30 +136,6 @@ class _WaitForUtils {
111
136
* Please be aware that nesting calls to [waitFor] can lead to deadlock if
112
137
* subsequent calls block waiting for a condition that is only satisfied when
113
138
* an earlier call returns.
114
- *
115
- * **NOTICE**
116
- * The `waitFor` feature is deprecated.
117
- * The feature was intended to solve a particular problem for existing code,
118
- * a problem introduced by a breaking change to the platform libraries.
119
- * The `waitFor` function is not suitable for general use.
120
- * The feature has shortcomings that can affect other code
121
- * running in the same isolate, including:
122
- * * A function call that looks synchronous may cause other asynchronous
123
- * events to run before it returns.
124
- * This is something synchronous code can usually assume not to happen,
125
- * and some code may have been written to take advantage of that
126
- * assumed behavior. Such code can fail in unexpected ways.
127
- * * Multiple nested calls to `waitFor` may block each other
128
- * since the most recent call always needs to complete
129
- * before any other call can complete.
130
- * Judicious use of `waitFor` is necessary to avoid unexpected deadlocks
131
- * which wouldn't happen if using `await` instead.
132
- * If more than one library in the same program is using `waitFor`,
133
- * then it's hard to avoid or control whether such blocking will happen.
134
- *
135
- * The feature is not actively maintained.
136
- * It will remain as-is to support the original problem it was added to solve,
137
- * at least until that problem can be solved in some other way.
138
139
*/
139
140
@Deprecated (
140
141
"This functionality is incomplete and may be removed in a later version" )
0 commit comments