Sha256: 5f895aa4fca959040f57478d78bb9de4aa0ce30101500a984598f2324db1034a
Contents?: true
Size: 778 Bytes
Versions: 3
Compression:
Stored size: 778 Bytes
Contents
require "monitor" #This module contains various tools to handle thread-safety easily and pretty. module Tsafe #Autoloader for subclasses. def self.const_missing(name) filep = "#{File.dirname(__FILE__)}/tsafe_#{name.to_s.downcase}" if RUBY_ENGINE == "jruby" and File.exists?("#{filep}_jruby.rb") require "#{filep}_jruby.rb" else require filep end raise "Still not loaded: '#{name}'." if !Tsafe.const_defined?(name) return Tsafe.const_get(name) end #JRuby can corrupt an array in a threadded env. Use this method to only get a synchronized array when running JRuby in order to not having to write "if RUBY_ENGINE"-stuff. def self.std_array return Tsafe::MonArray.new if RUBY_ENGINE == "jruby" return [] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tsafe-0.0.11 | lib/tsafe.rb |
tsafe-0.0.10 | lib/tsafe.rb |
tsafe-0.0.9 | lib/tsafe.rb |