Skip to content

Commit

Permalink
Add missing junit-async adaption for using Await.result
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Feb 7, 2023
1 parent baadd57 commit 2a71cff
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package scala.scalanative.junit

import scala.concurrent.Future
import scala.concurrent.{Await, Future}
import scala.concurrent.duration.Duration
import scala.scalanative.meta.LinktimeInfo.isMultithreadingEnabled

package object async {
type AsyncResult = Unit
def await(future: Future[_]): AsyncResult = {
scala.scalanative.runtime.loop()
future.value.get.get
if (isMultithreadingEnabled)
Await.result(future, Duration.Inf)
else {
scala.scalanative.runtime.loop()
future.value.get.get
}
}
}

0 comments on commit 2a71cff

Please sign in to comment.