22 " HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE" ,
33 " MISSING_KDOC_TOP_LEVEL" ,
44 " MISSING_KDOC_ON_FUNCTION" ,
5- " FILE_NAME_MATCH_CLASS"
5+ " FILE_NAME_MATCH_CLASS" ,
6+ " MatchingDeclarationName" ,
67)
78
89package com.saveourtool.save.core.utils
@@ -14,44 +15,11 @@ import platform.posix.fprintf
1415import platform.posix.stderr
1516import platform.posix.stdout
1617
17- /* *
18- * Atomic values
19- */
20- actual class AtomicInt actual constructor(value : Int ) {
21- private val holder = kotlin.native.concurrent.AtomicInt (value)
22-
23- /* *
24- * @return value
25- */
26- actual fun get (): Int = holder.value
27-
28- /* *
29- * @param delta increments the value_ by delta
30- * @return the new value
31- */
32- actual fun addAndGet (delta : Int ): Int = holder.addAndGet(delta)
33- }
34-
35- @Suppress(" FUNCTION_BOOLEAN_PREFIX" )
36- actual class AtomicBoolean actual constructor(value : Boolean ) {
37- private val holder = kotlin.native.concurrent.AtomicReference (value)
38-
39- /* *
40- * @return value
41- */
42- actual fun get (): Boolean = holder.value
43-
44- /* *
45- * @param expect expected value
46- * @param update updated value
47- * @return the result of the comparison
48- */
49- actual fun compareAndSet (expect : Boolean , update : Boolean ): Boolean = holder.compareAndSet(expect, update)
50- }
18+ import kotlinx.cinterop.ExperimentalForeignApi
5119
5220@Suppress(" USE_DATA_CLASS" )
5321actual class GenericAtomicReference <T > actual constructor(valueToStore : T ) {
54- private val holder: kotlin.native. concurrent.AtomicReference <T > = kotlin.native .concurrent.AtomicReference (valueToStore)
22+ private val holder: kotlin.concurrent.AtomicReference <T > = kotlin.concurrent.AtomicReference (valueToStore)
5523 actual fun get (): T = holder.value
5624 actual fun set (newValue : T ) {
5725 holder.value = newValue
@@ -104,11 +72,14 @@ actual fun writeToConsole(msg: String, outputType: OutputStreamType) {
10472 * @param msg a message string
10573 * @param output output stream (stdout or stderr)
10674 */
107- fun processStandardStreams (msg : String , output : OutputStreamType ) {
75+ private fun processStandardStreams (msg : String , output : OutputStreamType ) {
76+ @OptIn(ExperimentalForeignApi ::class )
10877 val stream = when (output) {
10978 OutputStreamType .STDERR -> stderr
11079 else -> stdout
11180 }
81+ @OptIn(ExperimentalForeignApi ::class )
11282 fprintf(stream, msg.escapePercent() + " \n " )
83+ @OptIn(ExperimentalForeignApi ::class )
11384 fflush(stream)
11485}
0 commit comments