Skip to content

Conversation

@dgrove-oss
Copy link
Contributor

To avoid leaking the block parameter of enumerateBytes,
we need to directly call CDispatch.dispatch_data_apply
(not _swift_dispatch_data_apply). However, we need to tell
the compiler that the internal closure that translates between
the C and Swift layers will not cause the captured block
parameter to escape. If SR-2313 were implemented, we could use
withoutActuallyEscaping. Since withoutActuallyEscaping is not available,
we instead use unsafeBitCast to bypass the compiler's analysis.

To avoid leaking the block parameter of enumerateBytes,
we need to directly call CDispatch.dispatch_data_apply
(not _swift_dispatch_data_apply). However, we need to tell
the compiler that the internal closure that translates between
the C and Swift layers will not cause the captured block
parameter to escape.  If SR-2313 were implemented, we could use
withoutActuallyEscaping.  Since withoutActuallyEscaping is not available,
we instead use unsafeBitCast to bypass the compiler's analysis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants