Skip to content

Commit

Permalink
remove scheduler references
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgk committed Mar 2, 2024
1 parent 034f5e2 commit f0545d5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PhilosopherCompetition {

def tryUpdateCycle(comp: Competition)(seating: comp.stableTable.Seating): Boolean = {
val res = comp.stableTable.tryEat(seating)
if (res) seating.philosopher.set(Thinking)(using comp.stableTable.engine.global.scheduler)
if (res) seating.philosopher.set(Thinking)
!res
}

Expand Down Expand Up @@ -69,9 +69,7 @@ class PhilosopherCompetition {
try {
thirdLock.lock()
try {
seating.philosopher.set(Thinking)(
using comp.stableTable.engine.global.scheduler,
)
seating.philosopher.set(Thinking)
} finally { thirdLock.unlock() }
} finally { secondLock.unlock() }
} finally { firstLock.unlock() }
Expand Down Expand Up @@ -127,9 +125,7 @@ class Competition extends BusyThreads {
table.eaten.set(0)
stableTable.seatings.foreach { seat =>
val phil: stableTable.engine.Var[Philosopher] = seat.philosopher
phil.set(Thinking)(
using stableTable.engine.global.scheduler,
)
phil.set(Thinking)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class MultiReverseFan {
@Benchmark
def run(step: Step, params: ThreadParams): Unit = {
val index = params.getThreadIndex
if (locks == null) sources(index).set(step.run())(using global.scheduler)
if (locks == null) sources(index).set(step.run())
else {
locks(index / groupSize).lock()
try {
sources(index).set(step.run())(using global.scheduler)
sources(index).set(step.run())
} finally locks(index / groupSize).unlock()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ class NaturalGraph {
}

@Benchmark
def run(step: Step): Unit = source.set(step.run())(using global.scheduler)
def run(step: Step): Unit = source.set(step.run())

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ReverseFan {
@Benchmark
def run(step: Step, params: ThreadParams): Unit =
if (isManual) synchronized {
sources(params.getThreadIndex).set(step.run())(using global.scheduler)
sources(params.getThreadIndex).set(step.run())
}
else sources(params.getThreadIndex).set(step.run())(using global.scheduler)
else sources(params.getThreadIndex).set(step.run())
}

0 comments on commit f0545d5

Please sign in to comment.