Module: Knj::Threadsafe

Defined in:
lib/knj/threadsafe.rb

Overview

This module contains various tools to handle thread-safety easily and pretty.

Defined Under Namespace

Modules: Monitored, Mutexed Classes: Proxy, Synced_array, Synced_hash

Class Method Summary collapse

Class Method Details

.std_arrayObject

JRuby can corrupt an array in a threadded env. Use this method to only get a synchronized array when running JRuby and not having to write “if RUBY_ENGINE”-stuff.



6
7
8
9
# File 'lib/knj/threadsafe.rb', line 6

def self.std_array
  return Synced_array.new if RUBY_ENGINE == "jruby"
  return []
end