Sam Schilling
01/21/2020, 8:08 PMIllegalStateException
? I don’t want to have to wrap every launch call in runblocking whenever I want to do some background work, but is there another way around that?
// Fails
runBlocking {
GlobalScope.launch {
println(1)
GlobalScope.launch { // IllegalStateException: no event loop, use runBlocking
println(2)
}
}
}
// Succeeds
runBlocking {
GlobalScope.launch {
println(1)
runBlocking {
GlobalScope.launch {
println(2)
}
}
}
}
Sam Schilling
01/21/2020, 9:56 PMGlobalScope.launch
for example throws an exception:
IllegalStateException: There is no event loop. Use runBlocking { ... } to start one.
The problem is if I surround my launch with runBlocking
, I am no longer performing an async task as it will block the calling thread until the launched coroutine completes.serebit
01/22/2020, 1:29 AMjk2018
01/22/2020, 5:27 PMantrax
01/22/2020, 8:58 PMRobert
01/22/2020, 10:15 PMSam Schilling
01/22/2020, 10:16 PMclass Foo {
var bar = arrayOf(...)
}
var foo = Foo()
GlobalScope.launch {
if (foo.bar.contains(...)) { ... }
}
// Once above coroutine is reached, any attempts to mutate foo.bar fail since it is frozen
ribesg
01/23/2020, 10:12 AMdispatch_async
call returning a result? i.e. how to bridge coroutines and multithreading as coroutines themselves can’t run outside of main threadSam Schilling
01/23/2020, 7:31 PMvar foo = "bar"
launch {
foo = "baz" // no need to worry about frozen foo since both actions are taken on the same thread
}
sikri
01/24/2020, 5:23 PMinterface Color { val color: Int
object BlackColor : Color { override val color = 0 }
class Car(
private val colorHolder: Color = BlackColor
) : Color by colorHolder
On iOS I have bad memory access 0x0, probably, due to reduced visibility, on trying to get value with car.color
while color.colorHolder.color
works fine.
On JVM works fine.
Were there any opened issues about implementation by delegation for native?
Having colorHolder public doesn’t fix it as well.Kris Wong
01/24/2020, 7:46 PMGarouDan
01/25/2020, 12:37 AMCould not find 'main' in '<root>' package.
I can move my main folder to the root package, but does someone know how can we configure the kotlin multiplatform plugin in order to provide another entry point?
It looks like we have a option -e
for command line but I’m not sure how to do that from the build.gradle.kts
configuration filenapperley
01/26/2020, 3:36 AMTask :cinteropNcursesLinuxArm32 FAILED
Exception in thread "main" java.lang.Error: /mnt/pi_image/usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found`
This error occurs with both the dynamic, and static versions of the ncurses library.nikolaymetchev
01/26/2020, 11:30 AMkpgalligan
01/26/2020, 7:44 PMkpgalligan
01/27/2020, 3:00 PMKris Wong
01/27/2020, 5:15 PMBruno_
01/27/2020, 6:46 PMKavan
01/27/2020, 7:58 PMGarouDan
01/27/2020, 8:03 PM> Task :my-module:linkReleaseFrameworkIosX64
warning: linking module flags ‘SDK Version’: IDs have conflicting values (‘[2 x i32] [i32 13, i32 2]’ from /var/folders/gx/x91q88394qd_bxbq5_wx1q840000gn/T/protocols6461040244319640293.bc with ‘[2 x i32] [i32 13, i32 0]’ from out)
AJ Alt
01/27/2020, 10:57 PMplatform.posix.isatty
from K/N? It seems that isatty(STDIN_FILENO)
always returns 0 on my machine (calling the built binary directly, not though gradle). Calling isatty(fileno(stdout))
in the same way from a C program returns the expected values.Patrick
01/28/2020, 10:35 AMfun test = runBlocking<Unit> {
someLibraryCode()
}
and I call this function from my C code, the program crashes with the message: There is no event loop. Use runBlocking { ... } to start one.
How am I supposed to handle this, if I want to call this function from C? Is it possible to wrap the entire program in runBlocking<Unit> {...}
, like I can do in a K/N project?
Is there another way to avoid this error?Patrick
01/28/2020, 10:36 AMtapchicoma
01/28/2020, 2:41 PMspec.libraries = "c++"
to generated podspec? As far as I understand kotlin native does not generate c++ code or link with c++ libraries for ios targets.Kris Wong
01/28/2020, 3:42 PMlet
block?
NSURLSession.sharedSession.dataTaskWithRequest(
NSURLRequest(NSURL(string = "<http://lsudflasfnlnf>")),
requestBlock@ { data: NSData?, urlResponse: NSURLResponse?, error: NSError? ->
error?.let {
return@requestBlock
}
}.freeze()
).resume()
Dominaezzz
01/28/2020, 4:51 PMnapperley
01/29/2020, 1:13 AMTobi
01/29/2020, 9:12 AMholder
🤔
class ArgHolder(var arg: JobArg?) {
fun getAndClear(): JobArg {
val temp = arg!!
arg = null
return temp
}
}
@Test
fun stillVisible() {
val holder = ArgHolder(JobArg("Hi"))
assertFails {
worker.execute(TransferMode.SAFE, { holder.getAndClear() }) {
print(it)
}
}
}
Luke Kellett
01/29/2020, 8:37 PMclass ThreadSafetyTest {
@SharedImmutable
val mapper: (value: String) -> String = { value: String ->
"Mapped: $value"
}
@SharedImmutable
val mapper2 = "Mapper 2"
}
napperley
01/30/2020, 2:23 AM<http://xxxxxx>:xxxx
parameter, both the release and debug binaries work normally, and return this result:
Response:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<title>Prometheus Time Series Collection and Processing Server</title>
...
When the --list-labels <http://xxxxxx>:xxxx
program parameters are used instead the debug binary works fine, however the release binary exhibits some strange behaviour where no labels are printed. The release binary should be outputting something similar to the debug binary:
Total Labels: 48
* __name__
* address
* battery
* branch
* broadcast
* call
* cell
* chip
* chip_name
...
napperley
01/30/2020, 2:23 AM<http://xxxxxx>:xxxx
parameter, both the release and debug binaries work normally, and return this result:
Response:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="noindex,nofollow">
<title>Prometheus Time Series Collection and Processing Server</title>
...
When the --list-labels <http://xxxxxx>:xxxx
program parameters are used instead the debug binary works fine, however the release binary exhibits some strange behaviour where no labels are printed. The release binary should be outputting something similar to the debug binary:
Total Labels: 48
* __name__
* address
* battery
* branch
* broadcast
* call
* cell
* chip
* chip_name
...
Artyom Degtyarev [JB]
01/30/2020, 9:11 AMdata class LabelsResponse(val status: String, val data: ArrayList<String>)
Nevertheless, we’re still looking for the root cause of this behavior.olonho
01/30/2020, 2:35 PMnapperley
01/30/2020, 8:07 PMolonho
01/31/2020, 6:50 AM