Skip to content

Commit

Permalink
Yield when sleep (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
aoli-al authored Nov 5, 2024
1 parent 568d3fe commit 7c0892a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/src/main/kotlin/org/pastalab/fray/core/RuntimeDelegate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,15 @@ class RuntimeDelegate(val context: RunContext) : org.pastalab.fray.runtime.Deleg
return probe
}

override fun onThreadSleepDuration(duration: Duration?) {}
override fun onThreadSleepDuration(duration: Duration?) {
Thread.yield()
}

override fun onThreadSleepMillis(millis: Long) {}
override fun onThreadSleepMillis(millis: Long) {
Thread.yield()
}

override fun onThreadSleepMillisNanos(millis: Long, nanos: Int) {}
override fun onThreadSleepMillisNanos(millis: Long, nanos: Int) {
Thread.yield()
}
}

0 comments on commit 7c0892a

Please sign in to comment.