Skip to content

Commit

Permalink
KMM :: Internal :: Add currentThreadName() utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
franmontiel committed Oct 2, 2023
1 parent 1d8b150 commit e46dc6f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.harmony.kotlin.common

expect fun currentThreadName(): String
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.harmony.kotlin.common

import platform.Foundation.NSThread

actual fun currentThreadName(): String {
return NSThread.currentThread.name.let { threadName ->
if (threadName.isNullOrBlank()) "Unknown" else threadName
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.harmony.kotlin.common

actual fun currentThreadName(): String {
return Thread.currentThread().name
}

0 comments on commit e46dc6f

Please sign in to comment.