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 @@ -219,6 +219,8 @@ static void destroyJob(SWIFT_CONTEXT HeapObject *obj) {
219
219
}
220
220
221
221
AsyncTask::~AsyncTask () {
222
+ flagAsCompleted ();
223
+
222
224
// For a future, destroy the result.
223
225
if (isFuture ()) {
224
226
futureFragment ()->destroy ();
Original file line number Diff line number Diff line change @@ -357,6 +357,16 @@ inline void AsyncTask::flagAsSuspended() {
357
357
}
358
358
}
359
359
360
+ // READ ME: This is not a dead function! Do not remove it! This is a function
361
+ // that can be used when debugging locally to instrument when a task actually is
362
+ // dealloced.
363
+ inline void AsyncTask::flagAsCompleted () {
364
+ #if SWIFT_TASK_PRINTF_DEBUG
365
+ fprintf (stderr, " [%lu] task completed %p\n " ,
366
+ _swift_get_thread_id (), this );
367
+ #endif
368
+ }
369
+
360
370
inline void AsyncTask::localValuePush (const HeapObject *key,
361
371
/* +1 */ OpaqueValue *value,
362
372
const Metadata *valueType) {
You can’t perform that action at this time.
0 commit comments