-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider getting rid of common locks and posix interop #324
Comments
It would be nice to do it in 1.9.20 scope, but taking into account, it's a library-level change, it worth returning to it after all Kotlin-repo-related changes are merged. Feel free to split the issue into multiple ones as you see fit |
Note, that other libraries (like Compose multiplatform) also need locks and, AFAIU, currently depend on atomicfu's locks. Thus, deprecating them without providing a replacement will raise questions. Atomicfu locks need to be replaced with the proper (and fast) locks that should be integrated into the Kotlin standard library. They'll definitely have to come to stdlib as a part of wider support for threads in stdlib, but, in reality, locks don't have to wait for threads and can appear earlier. P.S. Atomicfu locks are slow (which is another reason to redo them anyway) and that is actually causing concerns in Compose multiplatform. |
Indeed. The moment we deprecate it, we'll see the proper demand and will act accordingly, depending on our constraints. The poor man's [initial] replacement is to copy-paste
Sure thing. But first we both have to design proper threading abstraction and gather at least the initial requirements for proper locking |
Note about 1: removing previously published cinterop could be incompatible change in dependency resolution: icerockdev/moko-units#81 (not sure, that there is YouTrack issue about this) |
Just speculating and for sure don't know all details, but considering that some day in future:
May be in that case it make sense to merge Or another idea to not clutter stdlib with things needed for specific use-cases (threads, locks, etc) may be it's possible to introduce some new |
Currently, atomicfu provides access to two [on first glance] distinct API sets that are off overall atomicfu direction and are rather legacy of the past that obstruct the reasoning, maintenance and performance work of other libraries:
This one leaks to public API (due to how interop is implemented in K/N) and creates additional difficulties in train/aggregate/overall maintenance. This interop part can be completely removed and replaced with the corresponding calls from
posix.platform
package (e.g.platform.posix.pthread_mutex_init()
) .We consider this step fully backwards compatible.
kotlinx.atomicfu.locks
package.With the rising popularity of multiplatform,
atomicfu
starts to be [transitively] present in various projects, including other foundational libraries (link, e.g. Ktor), meaning that our quite ad-hoc and tailored for a very specific need API (SyncrhonizedObject
) is leaking into public surface.Effectively it means that soon we won't be able to do anything with
kotlinx.atomicfu.locks
package, sealing its public API.I propose to start decommissioning it -- starting from warning-level deprecation, eventually raising it to error; in
kotlinx.coroutines
we can just roll our own, tailoredSyncrhonizedObject
/ReentrantLock
The text was updated successfully, but these errors were encountered: