lib/finitio.rb in finitio-0.7.0.pre.rc4 vs lib/finitio.rb in finitio-0.7.0
- old
+ new
@@ -14,28 +14,30 @@
IDENTITY = ->(object){ object }
ANY_TYPE = AnyType.new
+ LOCK = Mutex.new
+
STDLIB_PATHS = [
File.expand_path('../finitio/stdlib', __FILE__)
]
MEMOIZED_SYSTEMS = {}
- MEMOIZATION_SEMAPHORE = Mutex.new
-
def stdlib_path(path)
- STDLIB_PATHS << path
+ LOCK.synchronize {
+ STDLIB_PATHS << path
+ }
end
def parse(source)
Syntax.parse(source)
end
def system(source)
- MEMOIZATION_SEMAPHORE.synchronize {
+ LOCK.synchronize {
_system(source)
}
end
def _system(source)
@@ -46,10 +48,10 @@
end
end
private :_system
def clear_saved_systems!
- MEMOIZATION_SEMAPHORE.synchronize {
+ LOCK.synchronize {
MEMOIZED_SYSTEMS.clear
}
end
def ast(source)