Synchronized
@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) @DeprecatedSinceKotlin("1.8") annotation class Synchronized
(Common source) (JS source)
@Target([AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER]) annotation class Synchronized
(source)
For JVM
Marks the JVM method generated from the annotated function as synchronized
, meaning that the method
will be protected from concurrent execution by multiple threads by the monitor of the instance (or,
for static methods, the class) on which the method is defined.
Note that for an extension function, the monitor of the facade class, where it gets compiled to a static method, is used. Therefore, this annotation is recommended to be applied only to member functions and properties. In other cases, use synchronized function and explicitly specify the lock to be used.
For Common
Marks the JVM method generated from the annotated function as synchronized
, meaning that the method
will be protected from concurrent execution by multiple threads by the monitor of the instance (or,
for static methods, the class) on which the method is defined.
Note that for an extension function, the monitor of the facade class, where it gets compiled to a static method, is used. Therefore, this annotation is recommended to be applied only to member functions and properties.
Constructors
<init>
Marks the JVM method generated from the annotated function as synchronized
, meaning that the method
will be protected from concurrent execution by multiple threads by the monitor of the instance (or,
for static methods, the class) on which the method is defined.
<init>()
Extension Properties
annotationClass
Returns a KClass instance corresponding to the annotation type of this annotation.
val <T : Annotation> T.annotationClass: KClass<out T>