Wietlol
12/07/2020, 10:28 PMBruce McLaren
12/08/2020, 1:07 AMMichal Klimczak
12/08/2020, 2:47 PMfun initLogging() {
Napier.base(DebugAntilog())
GlobalScope.launch {
withContext(Dispatchers.Default) {
Napier.base(DebugAntilog())
}
}
}
Is there a less hacky way to achieve that? I assume I need a different Napier instance on each thread, since they are @ThreadLocal
, right?tarek
12/08/2020, 4:04 PMcinterops
and not cocoapods?darkmoon_uk
12/09/2020, 12:29 AMkonan
target ?
I gather this would require an upgrade from current LLVM 8.0 based back-end, as RISC-V was introduced in 9.0.
Perhaps this will come along with the IR based compiler?
Asking due to an opportunity highlighted in #embedded-kotlinAmritansh
12/10/2020, 1:05 AMSCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, "8.8.8.8");
SCNetworkReachabilityFlags flags;
BOOL success = SCNetworkReachabilityGetFlags(reachability, &flags);
CFRelease(reachability);
if (!success) {
return ConnectionTypeUnknown;
}
BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0);
BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0);
BOOL isNetworkReachable = (isReachable && !needsConnection);
if (!isNetworkReachable) {
return ConnectionTypeNone;
} else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
return ConnectionType3G;
} else {
return ConnectionTypeWiFi;
}
This code is to detect Network connection typeAnimesh Sahu
12/10/2020, 3:47 PMCaused by: kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlin.collections.HashMap@18af58
I tried making the reference atomic, but that doesn't change the reference of underlying hash table atomic so exception is still thrown, is there any built-in data-structure to use?Animesh Sahu
12/13/2020, 1:28 PM@ThreadLocal
annotated property gets allocated for every thread everytime a new thread is created or when it is accessed for the first time?Kuba Petržílka
12/14/2020, 1:16 PMfun <reified T : kotlinx.cinterop.CVariable> alloc(): T
extension function for kotlinx.cinterop.NativePlacement
without any arguments anymore or where am I supposed to import it from?mkrussel
12/14/2020, 7:25 PMkotlin {
ios {
binaries {
framework {
baseName = "SharedCode"
export(Deps.kotlinDateTime)
export(project(":pangea-core"))
export(project(":pangea-coroutines"))
export(project(":pangea-gis"))
export(project(":pangea-time"))
export(project(":pangea-data"))
export(project(":pangea-visual"))
export(project(":pangea-overlay"))
export(project(":pangea-source"))
export(project(":pangea-map"))
export(project(":pangea-mapbox"))
}
}
}
}
When I do this I do not see anything about KotlinDateTime in the build output. Not listed in the list of libraries that were exported.
When opening the produced header for the framework that gets generated. Instant is called SharedCodeKotlinx_datetimeInstant
which is the pattern I saw for non exported classes. The converter functions for going from Instant to NSDate and back are also not there.Anthony Pages
12/16/2020, 3:57 PM@ThreadLocal
var counter = MutableStateFlow(0)
class FlowAndCoroutines {
fun observeOnMain(callback: () -> Unit){
MainScope().async(Dispatchers.Main) {
counter.collect {value ->
callback()
}
}
}
fun triggerCollect() {
MainScope().async(Dispatchers.Main) {
counter.emit(counter.value + 1)
}
}
}
Now on iOS,
let flowTest = FlowAndCoroutines()
flowTest.observeOnMain {
print("Callback called")
}
// In MAIN thread
flowTest.triggerCollect() // output "Callback called"
// In another thread
flowTest.triggerCollect() // Throw exception IncorrectDereferenceException
Marc Reichelt
12/16/2020, 5:39 PM> Task :command-line:linkDebugExecutableNative
e: Compilation failed: The /root/.konan/dependencies/clang-llvm-8.0.0-linux-x86-64/bin/clang++ command returned non-zero exit code: 137.
output:
* Source files:
* Compiler version info: Konan: 1.4.21 / Kotlin: 1.4.21
* Output kind: PROGRAM
e: org.jetbrains.kotlin.konan.KonanExternalToolFailure: The /root/.konan/dependencies/clang-llvm-8.0.0-linux-x86-64/bin/clang++ command returned non-zero exit code: 137.
output:
at org.jetbrains.kotlin.konan.exec.Command.handleExitCode(ExecuteCommand.kt:112)
at org.jetbrains.kotlin.konan.exec.Command.execute(ExecuteCommand.kt:73)
at org.jetbrains.kotlin.backend.konan.BitcodeCompiler.runTool(BitcodeCompiler.kt:31)
....
Does anyone know how to find out what exactly went wrong here? (I’m running this inside Docker btw)Kuba Petržílka
12/17/2020, 1:00 AM/mnt/agent/work/f01984a9f5203417/runtime/src/main/cpp/Memory.cpp:1271: runtime assert: Must be positive
Any ideas how I can get some clue what am I doing wrong?jean
12/17/2020, 10:26 AMBruce McLaren
12/17/2020, 7:36 PMactual val Main: CoroutineDispatcher = NsQueueDispatcher(dispatch_get_main_queue())
actual val Background: CoroutineDispatcher = Main
internal class NsQueueDispatcher(
private val dispatchQueue: dispatch_queue_t
) : CoroutineDispatcher() {
override fun dispatch(context: CoroutineContext, block: Runnable) {
dispatch_async(dispatchQueue) {
block.run()
}
}
}
Patrick
12/18/2020, 1:27 PMconst char*
? I've read the documentation but couldn't figure out how to do it. Adding noStringConversion = xxx
doesn't seem to do anything for me. I don't want to convert to a String before passing the value, I just want to pass the ByteArray as is.Animesh Sahu
12/20/2020, 6:18 AMKuba Petržílka
12/20/2020, 9:48 AMAnimesh Sahu
12/20/2020, 1:30 PMCompilation failed: Parameter specified as non-null is null: method kotlin.collections.CollectionsKt___CollectionsKt.joinToString, parameter $this$joinToString
I haven't used joinToString in my project though this error comes in when I define a global variable:
@SharedImmutable
private val globalVar: AtomicRef<ObjectType?> = atomic(null)
blob thinking upside down
Edit: Even with normal variable on top level scope this happens (also tested on @ThreadLocal
).Slackbot
12/22/2020, 4:18 AMeinsjannis
12/22/2020, 9:16 AMJames Fu
12/23/2020, 8:44 AMaleksey.tomin
12/23/2020, 4:28 PMmemScoped {
if (...) {
value?.let { callVoidFunction1() }
} else if (..) {
callVoidFunction1()
}
}
I have error on IDEA: 'if' must have both main and 'else' branches if used as an expression
I can fix it by add } else {
at end but it looks like ugly.James Fu
12/24/2020, 2:11 AMAnimesh Sahu
12/24/2020, 5:34 AMEnnio Masi
12/29/2020, 12:13 AMesdudnik
12/29/2020, 12:05 PMdispatch_get_main_queue
? I can’t find anything in changelogs abouts this. Thanks)eygraber
12/30/2020, 4:02 PMwuseal
12/31/2020, 6:44 AMthrowable.printStack()
from io/ktor/utils/io/ExceptionUtilsJs.kt:
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlinx.coroutines.ChildHandleNode@38b8508
at 0 iosApp 0x0000000101f24adf kfun:kotlin.Throwable#<init>(kotlin.String?){} + 95
at 1 iosApp 0x0000000101f1d5cd kfun:kotlin.Exception#<init>(kotlin.String?){} + 93
at 2 iosApp 0x0000000101f1d83d kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 93
at 3 iosApp 0x0000000101f544dd kfun:kotlin.native.concurrent.InvalidMutabilityException#<init>(kotlin.String){} + 93
at 4 iosApp 0x0000000101f548af ThrowInvalidMutabilityException + 431
at 5 iosApp 0x0000000102051590 MutationCheck + 128
at 6 iosApp 0x00000001021605f8 kfun:kotlinx.coroutines.internal.LinkedListNode#<set-_next>(kotlinx.coroutines.internal.LinkedListNode){} + 104
at 7 iosApp 0x000000010216099d kfun:kotlinx.coroutines.internal.LinkedListNode#addLast(kotlinx.coroutines.internal.LinkedListNode){} + 285
at 8 iosApp 0x0000000102160ce8 kfun:kotlinx.coroutines.internal.LinkedListNode#addOneIfEmpty(kotlinx.coroutines.internal.LinkedListNode){}kotlin.Boolean + 232
at 9 iosApp 0x00000001021131c1 kfun:kotlinx.coroutines.JobSupport.promoteSingleToNodeList#internal + 465
at 10 iosApp 0x0000000102111e8a kfun:kotlinx.coroutines.JobSupport#invokeOnCompletion(kotlin.Boolean;kotlin.Boolean;kotlin.Function1<kotlin.Throwable?,kotlin.Unit>){}kotlinx.coroutines.DisposableHandle + 2010
at 11 iosApp 0x0000000102111631 kfun:kotlinx.coroutines.JobSupport#invokeOnCompletion(kotlin.Function1<kotlin.Throwable?,kotlin.Unit>){}kotlinx.coroutines.DisposableHandle + 209
at 12 iosApp 0x00000001022aab42 kfun:io.ktor.client#HttpClient(io.ktor.client.engine.HttpClientEngineFactory<0:0>;kotlin.Function1<io.ktor.client.HttpClientConfig<0:0>,kotlin.Unit>){0§<io.ktor.client.engine.HttpClientEngineConfig>}io.ktor.client.HttpClient + 1138
at 13 iosApp 0x00000001022eed90 kfun:io.ktor.client#HttpClient(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>){}io.ktor.client.HttpClient + 640
at 14 iosApp 0x00000001022eefb0 kfun:io.ktor.client#HttpClient$default(kotlin.Function1<io.ktor.client.HttpClientConfig<*>,kotlin.Unit>?;kotlin.Int){}io.ktor.client.HttpClient + 304
at 15 iosApp 0x0000000101e7e9e8 kfun:wu.seal.app.idle.common.newslist.model.NewsListRepositoryImp.$loadDataCOROUTINE$8#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 3800
at 16 iosApp 0x0000000101e80f75 kfun:wu.seal.app.idle.common.newslist.model.NewsListRepositoryImp#loadData(<http://kotlin.Int;kotlin.Int|kotlin.Int;kotlin.Int>){}wu.seal.app.idle.common.base.ResponseData<kotlin.collections.List<wu.seal.app.idle.common.newslist.model.News>> + 309
at 17 iosApp 0x0000000101e81b2f kfun:wu.seal.app.idle.common.newslist.usercase.LoadMoreNewsListUserCase.$executeCOROUTINE$9#invokeSuspend(kotlin.Result<kotlin.Any?>){}kotlin.Any? + 1455
at 18 iosApp 0x0000000101e82896 kfun:wu.seal.app.idle.common.newslist.usercase.LoadMoreNewsListUserCase#execute(){} + 246
at 19 iosApp 0x0000000101e79a9d kfun:wu.seal.app.idle.common.newslist.NewsListPresenter.$executeLoadMoreNewsListUserCase$lambda-2COROUTINE$7.invokeSuspend#internal + 749