AAkira / Napier

Logging library for Kotlin Multiplatform
Apache License 2.0
786 stars 34 forks source link

baseArray replaced with atomic - fix logging from another thread on iOS #56 #61

Closed PhilipDukhov closed 3 years ago

PhilipDukhov commented 3 years ago

This is fix for #56. The problem is in iOS concurrency, which I fixed by storing antilogs in an atomic list. In order to improve performance on all platforms except iOS AtomicRef is just container for a value, without additional thread safety - as it's not needed.

AAkira commented 3 years ago

@PhilipDukhov

Could you resolve this conflict? like this

https://github.com/AAkira/Napier/commit/a61a8998e69fa2013ccc03602802973c9b735c32

AAkira commented 3 years ago

Or please enable this.

https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork

PhilipDukhov commented 3 years ago

"Allow edits by maintainers" checkmark is on While this fix worked when I made it, after some kotlin releases it stopped working.

Then I had been able to fix it by also removing @ThreadLocal, as it's not needed when using Atomics

AAkira commented 3 years ago

@PhilipDukhov

Thank you so much!

Then I had been able to fix it by also removing @ThreadLocal, as it's not needed when using Atomics

Yes, I checked this PR on my local project before. It worked. 👍 But I was really busy. Sorry for the late reply.

While this fix worked when I made it, after some Kotlin releases it stopped working.

Maybe it works I'll fix this if it doesn't work.