File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
stdlib/public/Concurrency Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class AsyncContext;
31
31
class Executor ;
32
32
class Job ;
33
33
struct OpaqueValue ;
34
+ struct SwiftError ;
34
35
class TaskStatusRecord ;
35
36
36
37
// / An ExecutorRef isn't necessarily just a pointer to an executor
@@ -323,6 +324,12 @@ class AsyncTask : public HeapObject, public Job {
323
324
reinterpret_cast <char *>(this ) + storageOffset (resultType));
324
325
}
325
326
327
+ // / Retrieve the error.
328
+ SwiftError *&getError () {
329
+ return *reinterpret_cast <SwiftError **>(
330
+ reinterpret_cast <char *>(this ) + storageOffset (resultType));
331
+ }
332
+
326
333
// / Compute the offset of the storage from the base of the future
327
334
// / fragment.
328
335
static size_t storageOffset (const Metadata *resultType) {
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ void FutureFragment::destroy() {
34
34
break ;
35
35
36
36
case Status::Error:
37
- swift_unknownObjectRelease (getStoragePtr ( ));
37
+ swift_unknownObjectRelease (reinterpret_cast <OpaqueValue *>( getError () ));
38
38
break ;
39
39
}
40
40
}
@@ -300,8 +300,7 @@ swift::swift_task_future_wait(AsyncTask *task, AsyncTask *waitingTask) {
300
300
case FutureFragment::Status::Error:
301
301
return TaskFutureWaitResult{
302
302
TaskFutureWaitResult::Error,
303
- *reinterpret_cast <OpaqueValue **>(
304
- task->futureFragment ()->getStoragePtr ())};
303
+ reinterpret_cast <OpaqueValue *>(task->futureFragment ()->getError ())};
305
304
}
306
305
}
307
306
You can’t perform that action at this time.
0 commit comments