I have a situation in which I have a non-thread safe resource which performs computations. So I need to serialize usage of this resource. In this particular case, it is an embedded Scala interpreter.
I do not want to block threads waiting for access to this resource, so I want to use Promise
. Currently the way I'm doing this is to create a single threaded Strategy
for each interpreter. This sucks because it means there are as many threads as there are interpreters, and they will be idle when the interpreter is not being used.
So far I've thought of 2 possible solutions that allow me to still use Promise
s
- Introduce an
emptyPromise
constructor. This was done in scalaz 6, but either didn't get ported to scalaz 7 or it was purposefully dropped (otherwise I'd just add it back in and be done with it). I could then cre