Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Almost Done ... Still Stuckin' Wiith Some MSG Error while The Slave Should Recieve ...
[simgrid.git] / src / bindings / ruby / Slave.rb
1 require 'msg'
2 require 'RubyProcess'
3 require 'RubyTask'
4 include MSG
5
6 class Slave < RbProcess
7   
8   def initialize()
9     super()
10   end
11   
12  # msg_main : that function that will be executed when Running Simulation
13   def msg_main(args)
14     puts "Hello From Slave"
15     s_mailbox = "slave>>" + args[0]
16     while true
17      
18       p "Hellow...................here3 "+s_mailbox
19       task = RbTask.receive(s_mailbox)
20       task_name = RbTask.name(task)
21       if ( task_name == "finalize" )
22         puts "Slave" + s_mailbox + "got finalize msg"
23         break
24       end
25       puts "Slave " + s_mailbox + "Processing" + RbTask.name(task)
26       RbTask.execute(task)
27     end
28     puts "Slave " + s_mailbox + "I'm Done , See You !!"
29     end
30     
31   end
32   
33
34 # slave = Slave.new