File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -279,6 +279,10 @@ class AsyncTask : public Job {
279
279
void flagAsSuspended ();
280
280
void flagAsSuspended_slow ();
281
281
282
+ // / Flag that this task is now completed. This normally does not do anything
283
+ // / but can be used to locally insert logging.
284
+ void flagAsCompleted ();
285
+
282
286
// / Check whether this task has been cancelled.
283
287
// / Checking this is, of course, inherently race-prone on its own.
284
288
bool isCancelled () const ;
Original file line number Diff line number Diff line change @@ -225,6 +225,8 @@ static void destroyJob(SWIFT_CONTEXT HeapObject *obj) {
225
225
}
226
226
227
227
AsyncTask::~AsyncTask () {
228
+ flagAsCompleted ();
229
+
228
230
// For a future, destroy the result.
229
231
if (isFuture ()) {
230
232
futureFragment ()->destroy ();
Original file line number Diff line number Diff line change @@ -384,6 +384,16 @@ inline void AsyncTask::flagAsSuspended() {
384
384
}
385
385
}
386
386
387
+ // READ ME: This is not a dead function! Do not remove it! This is a function
388
+ // that can be used when debugging locally to instrument when a task actually is
389
+ // dealloced.
390
+ inline void AsyncTask::flagAsCompleted () {
391
+ #if SWIFT_TASK_PRINTF_DEBUG
392
+ fprintf (stderr, " [%lu] task completed %p\n " ,
393
+ _swift_get_thread_id (), this );
394
+ #endif
395
+ }
396
+
387
397
inline void AsyncTask::localValuePush (const HeapObject *key,
388
398
/* +1 */ OpaqueValue *value,
389
399
const Metadata *valueType) {
You can’t perform that action at this time.
0 commit comments