Sha256: 548f22f44a19d1aea9a1f00749926b234f01e4d1692c0f53670e81a7c4a93e58

Contents?: true

Size: 593 Bytes

Versions: 7

Compression:

Stored size: 593 Bytes

Contents

require 'slave'
#
# Slave.object can used when you want to construct an object in another
# process.  in otherwords you want to fork a process and retrieve a single
# returned object from that process as opposed to setting up a server.
#
  this = Process.pid
  that = Slave.object{ Process.pid }

  p 'this' => this, 'that' => that

#
# any object can be returned and it can be returned asychronously via a thread
#
  thread = Slave.object(:async => true){ sleep 2 and [ Process.pid, Time.now ] }
  this = [ Process.pid, Time.now ]
  that = thread.value 
  
  p 'this' => this, 'that' => that

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
slave-1.3.2 samples/g.rb
slave-1.3.1 samples/g.rb
slave-1.3.0 samples/g.rb
slave-1.2.2 samples/g.rb
slave-1.1.0 samples/g.rb
slave-1.2.0 samples/g.rb
slave-1.2.1 samples/g.rb