Skip to content
Snippets Groups Projects
Commit 2f4b69c9 authored by Manos Koukoutos's avatar Manos Koukoutos
Browse files

SolverPoolFactory

parent 220398f9
No related branches found
No related tags found
No related merge requests found
/* Copyright 2009-2016 EPFL, Lausanne */ /* Copyright 2009-2016 EPFL, Lausanne */
package leon package inox
package solvers package solvers
package combinators package combinators
...@@ -17,7 +17,9 @@ import scala.reflect.runtime.universe._ ...@@ -17,7 +17,9 @@ import scala.reflect.runtime.universe._
* growing/shrinking pool size... * growing/shrinking pool size...
*/ */
class SolverPoolFactory[+S <: Solver](ctx: LeonContext, sf: SolverFactory[S]) extends SolverFactory[S] { trait SolverPoolFactory extends SolverFactory { self =>
val sf: SolverFactory { val program: self.program.type; type S = self.S }
val name = "Pool(" + sf.name + ")" val name = "Pool(" + sf.name + ")"
...@@ -25,7 +27,7 @@ class SolverPoolFactory[+S <: Solver](ctx: LeonContext, sf: SolverFactory[S]) ex ...@@ -25,7 +27,7 @@ class SolverPoolFactory[+S <: Solver](ctx: LeonContext, sf: SolverFactory[S]) ex
val poolMaxSize = 5 val poolMaxSize = 5
private[this] val availables = Queue[S]() private[this] val availables = Queue[S]()
private[this] var inUse = Set[Solver]() private[this] var inUse = Set[S]()
def getNewSolver(): S = { def getNewSolver(): S = {
if (availables.isEmpty) { if (availables.isEmpty) {
...@@ -38,7 +40,7 @@ class SolverPoolFactory[+S <: Solver](ctx: LeonContext, sf: SolverFactory[S]) ex ...@@ -38,7 +40,7 @@ class SolverPoolFactory[+S <: Solver](ctx: LeonContext, sf: SolverFactory[S]) ex
s s
} }
override def reclaim(s: Solver) = { override def reclaim(s: S) = {
try { try {
s.reset() s.reset()
inUse -= s inUse -= s
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment