if you use `actor.offer(message)` (instead of `act...
# coroutines
z
if you use
actor.offer(message)
(instead of
actor.send(message)
when the
actor(capacity = Channel.UNLIMITED)
, is there locking involved?
my primary use case is that I want ensure delivery of the message, because the suspended
actor.send(message)
may get cancelled before delivery occurs. Think a
ViewModel#onCleared()
occurring which would cancel the scope in which
actor.send(..)
is called
d
locking or blocking?
z
locking
(I’m trying to write lock-free code)
d
I don't think
kotlinx.coroutines
uses locks ever.
Take that with a grain of salt of course.
g
I don't think that there is any locking with offer, an item will be added to lock-free queue
Also send to Unlimited channel should not work differently comparing to offer it would be mostly the same, because suspension point will return immediately