Sha256: 4acf911e128416f70ff62a48f124f1a88ac4fbb75426dad7ad9cffa56953b489

Contents?: true

Size: 740 Bytes

Versions: 2

Compression:

Stored size: 740 Bytes

Contents

# kernel method for asyncron calls
# basic version is :
#
# var= async { "ruby Code here" }
# var.value #> "ruby Code here"
#
# or
#
# var = async :parallelism do
#  "some awsome ruby code here!"
# end
#
module Kernel

  def async type= :VM ,&block

    case type.to_s.downcase[0]
      # Concurrency / VM / Green
      when "c","v","g"
        begin
          Asynchronous::Concurrency.new(block)
        end
      # Parallelism / OS / Native
      when "p","o","n"
        begin
          Asynchronous::Parallelism.new(block)
        end
      else
        begin
          Asynchronous::Concurrency.new(block)
        end

    end

  end

  def shared_memory
    Asynchronous::SharedMemory
  end unless method_defined? :shared_memory

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asynchronous-3.0.1 lib/asynchronous/kernel.rb
asynchronous-3.0.0.pre.pre lib/asynchronous/kernel.rb