Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1118f8017d240b79ee6d842f845682308e4df038
[simgrid.git] / examples / java / async / yield / Yielder.java
1 /* Copyright (c) 2017. The SimGrid Team. All rights reserved.               */
2
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. */
5
6 package async.yield;
7 import org.simgrid.msg.Msg;
8 import org.simgrid.msg.Host;
9 import org.simgrid.msg.Task;
10 import org.simgrid.msg.Process;
11 import org.simgrid.msg.HostFailureException;
12 import org.simgrid.msg.TimeoutException;
13 import org.simgrid.msg.TransferFailureException;
14
15 public class Yielder extends Process {
16   public Yielder (Host host, String name, String[] args) {
17     super(host, name, args);
18   }
19
20   @Override
21   public void main(String[] args) {
22     int yieldsCount = Integer.parseInt(args[0]);
23     for (int i=0; i<yieldsCount; i++)
24         yield();
25     Msg.info("Yielded "+yieldsCount+". Good bye now!");
26   }
27 }