Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 2449

Show
Ignore:
Timestamp:
07/12/07 14:11:46 (1 year ago)
Author:
kris
Message:

moved some things around

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/example/cluster/Add.d

    r2448 r2449  
    1212*******************************************************************************/ 
    1313 
    14 real multiply (real x, real y) 
     14real add (real x, real y) 
    1515{ 
    16         return x * y; 
     16        return x + y; 
    1717} 
    1818 
     
    3636*******************************************************************************/ 
    3737 
    38 class Add : NetworkCall 
     38class Subtract : NetworkCall 
    3939{ 
    4040        double  a, 
     
    5252        override void execute () 
    5353        { 
    54                 result = a + b; 
     54                result = a - b; 
    5555        } 
    5656 
  • trunk/example/cluster/tclient.d

    r2448 r2449  
    2424        auto channel = cluster.createChannel ("rpc.channel"); 
    2525 
     26        // an implicit task instance 
     27        auto add = new NetCall!(add); 
     28 
    2629        // an explicit task instance 
    27         auto add = new Add; 
    28  
    29         // an implicit task instance 
    30         auto mul = new NetCall!(multiply); 
     30        auto sub = new Subtract; 
    3131 
    3232        StopWatch w; 
     
    3838                  // both tasks are used in the same manner 
    3939                  add (1, 2, channel); 
    40                   mul (1, 2, channel); 
     40                  sub (3, 4, channel); 
    4141                  } 
    4242              Stdout.formatln ("{} calls/s", 20000/w.stop); 
  • trunk/example/cluster/tserver.d

    r2448 r2449  
    2828           { 
    2929           auto server = new TaskServer (new InternetAddress(arg.port), arg.log); 
    30            server.enroll (new Add); 
    31            server.enroll (new NetCall!(multiply)); 
     30           server.enroll (new NetCall!(add)); 
     31           server.enroll (new Subtract); 
    3232           server.start; 
    3333           }