1 /* Copyright (c) 2006-2015. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include "simgrid/s4u.h"
8 using namespace simgrid;
10 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "a sample log category");
12 class Worker : s4u::Process {
14 Worker(const char*procname, s4u::Host *host,int argc, char **argv)
15 : s4u::Process(procname,host,argc,argv){}
17 int main(int argc, char **argv) {
18 XBT_INFO("Hello s4u, I'm ready to serve");
20 char *msg = recvstr("worker");
21 XBT_INFO("I received '%s'",msg);
22 XBT_INFO("I'm done. See you.");
27 class Master : s4u::Process {
29 Master(const char*procname, s4u::Host *host,int argc, char **argv)
30 : s4u::Process(procname,host,argc,argv){}
32 int main(int argc, char **argv) {
33 XBT_INFO("Hello s4u, I have something to send");
34 sendstr("worker","GaBuZoMeu");
36 XBT_INFO("I'm done. See you.");
42 int main(int argc, char **argv) {
43 s4u::Engine *e = new s4u::Engine(&argc,argv);
44 e->loadPlatform("../../platforms/two_hosts_platform.xml");
46 new Worker("worker", s4u::Host::byName("host0"), 0, NULL);
47 new Master("master", s4u::Host::byName("host1"), 0, NULL);