diff tango/example/cluster/tclient.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tango/example/cluster/tclient.d	Fri Jan 11 17:57:40 2008 +0100
@@ -0,0 +1,42 @@
+/*******************************************************************************
+
+
+*******************************************************************************/
+
+import Add;
+
+import tango.io.Stdout;
+
+import tango.time.StopWatch;
+
+import tango.util.log.Configurator;
+
+import tango.net.cluster.tina.ClusterTask;
+
+/*******************************************************************************
+
+
+*******************************************************************************/
+
+void main (char[][] args)
+{
+        // an implicit task instance
+        auto add = new NetCall!(add);
+
+        // an explicit task instance
+        auto sub = new Subtract;
+
+        StopWatch w;
+        while (true)
+              {
+              w.start;
+              for (int i=10000; i--;)
+                  {
+                  // both task types are used in the same manner
+                  add (1, 2);
+                  sub (3, 4);
+                  }
+              Stdout.formatln ("{} calls/s", 20000/w.stop);
+              }
+}
+