Mercurial > projects > ldc
comparison tango/example/cluster/Add.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 |
comparison
equal
deleted
inserted
replaced
131:5825d48b27d1 | 132:1700239cab2e |
---|---|
1 /******************************************************************************* | |
2 | |
3 *******************************************************************************/ | |
4 | |
5 public import tango.net.cluster.NetworkCall; | |
6 | |
7 | |
8 /******************************************************************************* | |
9 | |
10 a Task function | |
11 | |
12 *******************************************************************************/ | |
13 | |
14 real add (real x, real y) | |
15 { | |
16 return x + y; | |
17 } | |
18 | |
19 | |
20 /******************************************************************************* | |
21 | |
22 a Task function | |
23 | |
24 *******************************************************************************/ | |
25 | |
26 int divide (int x, int y) | |
27 { | |
28 return x / y; | |
29 } | |
30 | |
31 | |
32 /******************************************************************************* | |
33 | |
34 a verbose Task message | |
35 | |
36 *******************************************************************************/ | |
37 | |
38 class Subtract : NetworkCall | |
39 { | |
40 double a, | |
41 b, | |
42 result; | |
43 | |
44 double opCall (double a, double b, IChannel channel = null) | |
45 { | |
46 this.a = a; | |
47 this.b = b; | |
48 send (channel); | |
49 return result; | |
50 } | |
51 | |
52 override void execute () | |
53 { | |
54 result = a - b; | |
55 } | |
56 | |
57 override void read (IReader input) {input (a)(b)(result);} | |
58 | |
59 override void write (IWriter output) {output (a)(b)(result);} | |
60 } |