Skip to content
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

Deprecate Mutex.onLock for removal #2794

Closed
qwwdfsad opened this issue Jun 29, 2021 · 0 comments
Closed

Deprecate Mutex.onLock for removal #2794

qwwdfsad opened this issue Jun 29, 2021 · 0 comments

Comments

@qwwdfsad
Copy link
Member

Apart from regular locking methods, coroutine's Mutex provides a selectable onLock method.

Selectable locking was added prior to version 1.0.0 for the sake of consistency and now adds more maintenance and public API burden than actual utility:

  • It cannot be used along with owner-based locking
  • It cannot be reliably aligned with similar synchronous primitives API, e.g. Semaphore
  • It obfuscated an API of Mutex-based primitives, such as ReadWriteMutex, where its read counter-part is cannot provide any selectable primitives
  • Its implementation, in a nutshell, relies on a code-heavy DCSS primitive, that implicitly increases the size of all Android applications that use Mutex in any way

As far as we know, it's neither used in our own coroutines-heavy internal codebases nor in any open-source projects and our research shows that it has no sane practical uses.

Thus the proposal is to deprecate it for removal in 1.6.0, deprecate with ERROR in 1.7.0 and, after further investigation, either remove it completely in 1.8.0 or provide a non-linearizable stub implementation and maintain it forever

qwwdfsad added a commit that referenced this issue Sep 30, 2021
qwwdfsad added a commit that referenced this issue Oct 6, 2021
yorickhenning pushed a commit to yorickhenning/kotlinx.coroutines that referenced this issue Jan 28, 2022
* Actually test 'onLock' and the corresponding concurrency and cancellation of Reactive's onSend
* Update benchmarks
* Non-linearizable implementation of PublisherCoroutine.onSend that isn't using Mutex.onLock
* Deprecate Mutex.onLock

Fixes Kotlin#2794

Co-authored-by: Dmitry Khalanskiy <Dmitry.Khalanskiy@jetbrains.com>
pablobaxter pushed a commit to pablobaxter/kotlinx.coroutines that referenced this issue Sep 14, 2022
* Actually test 'onLock' and the corresponding concurrency and cancellation of Reactive's onSend
* Update benchmarks
* Non-linearizable implementation of PublisherCoroutine.onSend that isn't using Mutex.onLock
* Deprecate Mutex.onLock

Fixes Kotlin#2794

Co-authored-by: Dmitry Khalanskiy <Dmitry.Khalanskiy@jetbrains.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant