@@ -134,13 +134,9 @@ void AsyncTask::completeFuture(AsyncContext *context, ExecutorRef executor) {
134
134
}
135
135
136
136
SWIFT_CC (swift)
137
- static void destroySimpleTask (SWIFT_CONTEXT HeapObject *obj) {
137
+ static void destroyTask (SWIFT_CONTEXT HeapObject *obj) {
138
138
auto task = static_cast <AsyncTask*>(obj);
139
139
140
- // FIXME: "Simple task" seems like it's not that useful a concept. We might
141
- // also have task-local storage to destroy.
142
- // assert(!task->isFuture());
143
-
144
140
// For a future, destroy the result.
145
141
if (task->isFuture ()) {
146
142
task->futureFragment ()->destroy ();
@@ -155,24 +151,23 @@ static void destroySimpleTask(SWIFT_CONTEXT HeapObject *obj) {
155
151
free (task);
156
152
}
157
153
158
- // / Heap metadata for a simple asynchronous task that does not
159
- // / include a future.
160
- static FullMetadata<HeapMetadata> simpleTaskHeapMetadata = {
154
+ // / Heap metadata for an asynchronous task.
155
+ static FullMetadata<HeapMetadata> taskHeapMetadata = {
161
156
{
162
157
{
163
- &destroySimpleTask
158
+ &destroyTask
164
159
},
165
160
{
166
161
/* value witness table*/ nullptr
167
162
}
168
163
},
169
164
{
170
- MetadataKind::SimpleTask
165
+ MetadataKind::Task
171
166
}
172
167
};
173
168
174
169
// / The function that we put in the context of a simple task
175
- // / (one with no future) to handle the final return.
170
+ // / to handle the final return.
176
171
SWIFT_CC (swift)
177
172
static void completeTask(AsyncTask *task, ExecutorRef executor,
178
173
AsyncContext *context) {
@@ -254,7 +249,7 @@ AsyncTaskAndContext swift::swift_task_create_future_f(
254
249
// Initialize the task so that resuming it will run the given
255
250
// function on the initial context.
256
251
AsyncTask *task =
257
- new (allocation) AsyncTask (&simpleTaskHeapMetadata , flags,
252
+ new (allocation) AsyncTask (&taskHeapMetadata , flags,
258
253
function, initialContext);
259
254
260
255
// Initialize the child fragment if applicable.
0 commit comments