[K/N] Fix interop_objc_kt56402 with different GCs ^KT-56402

Merge-request: KT-MR-9865
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
This commit is contained in:
Alexander Shabalin
2023-04-28 17:10:07 +00:00
committed by Space Team
parent dee3bbb4bf
commit 968bf424b4
2 changed files with 9 additions and 2 deletions
@@ -53,7 +53,12 @@ fun alloc(ctor: ((ULong) -> Unit) -> ULong): ULong = autoreleasepool {
fun waitDestruction(id: ULong) {
assertTrue(isMainThread())
kotlin.native.internal.GC.collect()
// Make sure the finalizers are not run on the main thread even for STMS.
withWorker {
execute(TransferMode.SAFE, {}) {
kotlin.native.internal.GC.collect()
}.result
}
while (true) {
spin()
if (!(id in aliveObjectIds)) {