@@ -290,23 +290,35 @@ class AsyncTask : public Job {
290
290
return ResumeTask (ResumeContext); // 'return' forces tail call
291
291
}
292
292
293
+ // / A task can have the following states:
294
+ // / * suspended: In this state, a task is considered not runnable
295
+ // / * enqueued: In this state, a task is considered runnable
296
+ // / * running on a thread
297
+ // / * completed
298
+ // /
299
+ // / The following state transitions are possible:
300
+ // / suspended -> enqueued
301
+ // / suspended -> running
302
+ // / enqueued -> running
303
+ // / running -> suspended
304
+ // / running -> completed
305
+ // / running -> enqueued
306
+ // /
307
+ // / The 4 methods below are how a task switches from one state to another.
308
+
293
309
// / Flag that this task is now running. This can update
294
310
// / the priority stored in the job flags if the priority has been
295
311
// / escalated.
296
312
// /
297
313
// / Generally this should be done immediately after updating
298
314
// / ActiveTask.
299
315
void flagAsRunning ();
300
- void flagAsRunning_slow ();
301
-
302
- // / Flag that this task is now suspended. This can update the
303
- // / priority stored in the job flags if the priority hsa been
304
- // / escalated. Generally this should be done immediately after
305
- // / clearing ActiveTask and immediately before enqueuing the task
306
- // / somewhere. TODO: record where the task is enqueued if
307
- // / possible.
316
+
317
+ // / Flag that this task is now suspended.
308
318
void flagAsSuspended ();
309
- void flagAsSuspended_slow ();
319
+
320
+ // / Flag that the task is to be enqueued on the provided executor
321
+ void flagAsEnqueuedOnExecutor (ExecutorRef newExecutor);
310
322
311
323
// / Flag that this task is now completed. This normally does not do anything
312
324
// / but can be used to locally insert logging.
0 commit comments