Skip to main content
0 votes
1 answer
25 views

Is kotlin coroutine Job's status is reliable for concurrency control?

I've read this sentence in the Java Concurrency in Practice book that: The result of Thread.getState should not be used for concurrency control, and is of limited usefulness for testing—its primary ...
Mohammadreza Khahani's user avatar
0 votes
0 answers
66 views

java.lang.NoSuchMethodError: void kotlinx.coroutines.CompletableDeferredImpl.initParentJob(kotlinx.coroutines.Job) when building Android project

I am getting the following error when trying to build my Android project: Cause 1229: java.lang.NoSuchMethodError: "void kotlinx.coroutines.CompletableDeferredImpl.initParentJob(kotlinx....
Hitesh Matnani's user avatar
2 votes
1 answer
74 views

How can I tie a coroutine's lifetime to the lifetime of an object?

I have some code similar to this: class Foo { var x = 0 init { GlobalScope.launch { while (true) { delay(1000) x += 1 }...
Seggan's user avatar
  • 216
0 votes
1 answer
128 views

Strictly depending on Coroutine 1.8.1 to use BroadcastChannel with Kotlin 2

I have a code base which is tightly coupled with BoradcastChannel and I can't update that for now. But I want to upgrade the dependencies to their latest, use kotlin2 and compose. I have changed my ...
msc87's user avatar
  • 1,037
0 votes
1 answer
32 views

Creating activity prevents spinner from spinning in Android

I have 2 activities in my app. When another one is called there is a spinner but it doesn't spin. I think it may be because the main thread is stuck. I moved all background tasks to Dispatchers.IO, ...
EnergyKickman's user avatar
5 votes
0 answers
118 views

Why is the action of Mutex.withLock not marked as suspend?

The action parameter of the withLock function is a lambda without the suspend keyword. Is there a reason for this missing keyword? In most cases, this lack of the suspend keyword isn't an issue ...
AndroidKotlinNoob's user avatar
1 vote
2 answers
149 views

Testing a function that creates a coroutine scope inside it

I have something like the following in Kotlin: class A { fun a(): Unit = TODO() } fun foo(a: A) { // Do something CoroutineScope(Dispatchers.IO).launch { delay(1000) a.a() ...
riccardo.cardin's user avatar
2 votes
2 answers
82 views

Deadlock when withContext() is combined with logging in object initializer

Consider the following Kotlin object: package com.example import org.slf4j.LoggerFactory import java.lang.Thread.currentThread import kotlinx.coroutines.Dispatchers import kotlinx.coroutines....
Андрей Щеглов's user avatar
0 votes
1 answer
65 views

Jetpack Compose `LazyColumn takes` ~3 to ~4seconds to reflect `mutableStateListOf` mutations even though `Flow` emits immediately [closed]

I switch between “chart windows” (weekly, monthly…). Upstream data is a hot Flow (think Room). To keep the list size stable, I render 30 fixed slots: real items in the first n, placeholders in the ...
Klem Lloyd Mwenya's user avatar
2 votes
1 answer
40 views

Implement same task for two different user interfaces in Kotlin [closed]

I am working on a program which has both a TUI (terminal user interface) as well as a GUI (graphical user interface). The program has some functions which take quite a long time to complete (waiting ...
Whirvis's user avatar
  • 356
0 votes
1 answer
82 views

Why does Android prohibit running IO-performing coroutines from the main thread? [closed]

Context and prior understanding: In Node.JS, I/O code is run in a thread pool / event loop parallel to the main JavaScript thread. async code is never truly blocking per-se, unless a blocking call (e....
anon's user avatar
  • 697
2 votes
1 answer
59 views

Unclear execution order of Kotlin coroutines

Why the output of this code is so unpredictable? suspend fun main() { val job1 = GlobalScope.launch { delay(1000L) println("World!") } val job2 = GlobalScope....
Kumar Atul's user avatar
0 votes
1 answer
51 views

SharedFlow emmited in another scope in a separated class is not collected

I have a Bluetooth tracker app. I try it to be clean. Everything related to scan is encapsulated in one class. I am injecting with Hilt. The problem is when I scan via Bluetooth for 10s, I emit the ...
sepideh's user avatar
  • 49
0 votes
0 answers
35 views

Missing MDCContext from kotlin web flux

I have a spring web flux based application, written in kotlin I am adding few information in reactor context by using web filter. I also have logging information which I set in MDCContext but I am ...
Abhishek kapoor's user avatar
0 votes
1 answer
75 views

Problems with Ktor receiving multipart: Flow invariant is violated

I am rather new to Ktor and try to upload a file to my server. This is the route: fun Application.module() { install(ContentNegotiation) { json() } routing { post("/upload") { ...
KCD's user avatar
  • 698

15 30 50 per page
1
2 3 4 5
338