Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[Lua] Renamed host 'power' to 'speed' for hosts
[simgrid.git] / examples / lua / splaySim / slave.lua
1 -- Copyright (c) 2011, 2014. The SimGrid Team.
2 -- All rights reserved.
3
4 -- This program is free software; you can redistribute it and/or modify it
5 -- under the terms of the license (GNU LGPL) which comes with this package.
6
7 -- Slave Function ---------------------------------------------------------
8 function Slave(...)
9
10 local my_mailbox="slave "..arg[1]
11 simgrid.info("Hello from lua, I'm a poor slave with mbox: "..my_mailbox)
12
13 while true do
14
15   local tk = simgrid.task.recv(my_mailbox);
16   if (simgrid.task.get_name(tk) == "finalize") then
17     simgrid.info("Slave '" ..my_mailbox.."' got finalize msg");
18     break
19   end
20   --local tk_name = simgrid.task.get_name(tk) 
21   simgrid.info("Slave '" ..my_mailbox.."' processing "..simgrid.task.get_name(tk))
22   simgrid.task.execute(tk)
23   simgrid.info("Slave '" ..my_mailbox.."': task "..simgrid.task.get_name(tk) .. " done")
24 end -- while
25
26 simgrid.info("Slave '" ..my_mailbox.."': I'm Done . See You !!");
27
28 end 
29
30 -- end_of_slave