Michal Klimczak
01/17/2021, 8:12 PMJavier
01/17/2021, 8:16 PMMichal Klimczak
01/17/2021, 8:20 PMJavier
01/17/2021, 8:36 PMJavier
01/17/2021, 8:38 PMJohn O'Reilly
01/17/2021, 8:43 PMJohn O'Reilly
01/17/2021, 8:46 PMMichal Klimczak
01/17/2021, 8:52 PMMichal Klimczak
01/17/2021, 8:54 PMJavier
01/17/2021, 8:56 PMJavier
01/17/2021, 8:57 PMJavier
01/17/2021, 8:57 PMMichal Klimczak
01/17/2021, 9:02 PMMichal Klimczak
01/17/2021, 9:04 PMJohn O'Reilly
01/17/2021, 9:04 PMJohn O'Reilly
01/17/2021, 9:06 PMfreeze
methods that need to be called when doing thatMichal Klimczak
01/17/2021, 9:06 PMMichal Klimczak
01/17/2021, 9:07 PMMichal Klimczak
01/17/2021, 9:07 PMrusshwolf
01/17/2021, 9:33 PMnrobi
01/18/2021, 6:28 AMdispose()
) and for the generics part expose some convenience lambdas. It doesn’t scale as well, but we wanted something more seamless on the swift side. It might depend on your use-case/architecture as well, but you can find an example hereMichal Klimczak
01/18/2021, 8:12 AMRunLoop.main
and then use Dispatchers.Main
in SuspendWrapper it's all good. I also succeeded with using Dispatchers.Default
and something specific for the Combine side, but can't remember. Will perform some tests and get back to you.Michal Klimczak
01/18/2021, 8:18 AMMichal Klimczak
01/18/2021, 9:33 AM.receive(on: DispatchQueue.global())
.flatMap { username in
createPublisher(
scope: coroutineScope,
wrapper: loadUserUseCase.loadUser(username: username)
)
When I do this I get
Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared kotlinx.coroutines.internal.ContextScope@4f9348 from other thread
I guess this is just not something that I should do - I mean the createPublisher
has to be done on the original thread that touched the coroutineScope
param, otherwise I'm in trouble, right? Or am I reading it all wrong?russhwolf
01/18/2021, 3:46 PMcoroutineScope
is being accessed across threads and needs to be frozen.Arkadii Ivanov
01/19/2021, 12:10 AM.wrap()
extension function.