From 122ec85bf082fb23df6e7a10a59bf0b5862f6ecc Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Thu, 18 Oct 2018 17:14:00 +0300 Subject: [PATCH] Add ThreadLocal and SharedImmutable native annotations as OptionalExpectation to kotlin.native.concurrent --- .../common/src/kotlin/NativeAnnotationsH.kt | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libraries/stdlib/common/src/kotlin/NativeAnnotationsH.kt diff --git a/libraries/stdlib/common/src/kotlin/NativeAnnotationsH.kt b/libraries/stdlib/common/src/kotlin/NativeAnnotationsH.kt new file mode 100644 index 00000000000..57aeaf0d20f --- /dev/null +++ b/libraries/stdlib/common/src/kotlin/NativeAnnotationsH.kt @@ -0,0 +1,32 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package kotlin.native.concurrent + +/** + * Marks a top level variable with a backing field or an object as thread local. + * The object remains mutable and it is possible to change its state, + * but every thread will have a distinct copy of this object, + * so changes in one thread are not reflected in another. + * + * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. + */ +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS) +@Retention(AnnotationRetention.BINARY) +@OptionalExpectation +public expect annotation class ThreadLocal() + +/** + * Marks a top level variable with a backing field or an object as immutable. + * It is possible to share such object between multiple threads, but it becomes deeply frozen, + * so no changes can be made to its state or the state of objects it refers to. + * + * PLEASE NOTE THAT THIS ANNOTATION MAY GO AWAY IN UPCOMING RELEASES. + */ +@Target(AnnotationTarget.PROPERTY) +@Retention(AnnotationRetention.BINARY) +@OptionalExpectation +public expect annotation class SharedImmutable() +