On 27/02/2017 19:34, Nate Chandler via swift-users wrote:
Hi Ole,A quick follow-up--are you suggesting calling withExtendedLifetime inside the closure passed to async, as below? class AsyncHandle { let handle: Handle deinit { let handle: Handle = self.handle q.async { withExtendedLifetime(handle) {} } } }
Yes, that's what I'm suggesting. Sorry I didn't make that clear before. Since you mentioned that you couldn't use the stdlib's _fixLifetime function, I just wanted to point out that there is a public function in the stdlib for this purpose.
If so, it seems that that may be a final answer to (3). It does raise an additional question, however: (6) Would we expect calling withExtendedLifetime to have different behavior from calling an @inline(never) function from a closure enqueued async from deinit?
Yeah, I don't know the answer, sorry. _______________________________________________ swift-users mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-users
