Skip to content

Commit

Permalink
Fix JVM native name
Browse files Browse the repository at this point in the history
  • Loading branch information
vcoolish committed Sep 24, 2024
1 parent fa8cce7 commit 151f133
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions codegen/lib/templates/kotlin/android_class.erb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ actual class <%= entity.name %> private constructor(

<% unless entity.methods.select{ |x| x.name == "Delete" }.empty? -%>
@JvmStatic
@JvmName("nativeDelete")
external fun nativeDelete(handle: Long)
@JvmName("delete")
private external fun delete(handle: Long)
<%- end -%>
<%- constructors.each do |constructor| -%>

Expand Down Expand Up @@ -88,7 +88,7 @@ actual class <%= entity.name %> private constructor(
Thread.currentThread().interrupt()
}
}.run {
name = "WCFinalizingDaemon"
name = "<%= entity.name %>FinalizingDaemon"
isDaemon = true
priority = Thread.NORM_PRIORITY
start()
Expand All @@ -100,11 +100,10 @@ actual class <%= entity.name %> private constructor(
}

private fun doDeletes() {
var ref = queue.poll() as? <%= entity.name %>PhantomReference
while (ref != null) {
nativeDelete(ref.nativeHandle)
while (true) {
val ref = queue.remove() as <%= entity.name %>PhantomReference
delete(ref.nativeHandle)
references.remove(ref)
ref = queue.poll() as <%= entity.name %>PhantomReference
}
}
}
Expand Down

0 comments on commit 151f133

Please sign in to comment.