kotlinx-io icon indicating copy to clipboard operation
kotlinx-io copied to clipboard

CharsetNativeKt.platformUtf16 inaccessible outside main thread on native

Open fluidsonic opened this issue 6 years ago • 0 comments

platformUtf16 is only accessible on the main thread because it is not marked as @SharedImmutable. That breaks String.toByteArray().

This also breaks Ktor HttpClient on non-main threads (TextContent.bytes).

https://github.com/Kotlin/kotlinx-io/blob/44f0ebbf1026bb731ffb506c857aff5864e5343a/core/nativeMain/src/kotlinx/io/charsets/CharsetNative.kt#L192

fluidsonic avatar Jun 11 '19 23:06 fluidsonic