Hi, I'm wondering why `ReentrantReadWriteLock.writ...
# stdlib
r
Hi, I'm wondering why
ReentrantReadWriteLock.write
in
Locks.kt
is marked as
InlineOnly
. Is it to forbid Java from calling it? But what's reason behind it?
d
I recall that when lambda and default methods were first added in Java 8, they intentionally did not add the methods you'd expect on locks, specifically because code that used locks was often performance-sensitive, and the lambda methods were not efficient enough.
@InlineOnly
may have a similar motivation here.
d
I think it's because that would reduce determinism since allocating a lambda instance could trigger a garbage collection prior to acquiring the lock