source: tests/concurrency/actors/inherit.cfa @ ded6c2a6

ast-experimental
Last change on this file since ded6c2a6 was c26bea2a, checked in by Peter A. Buhr <pabuhr@…>, 18 months ago

first attempt at renaming directory tests/concurrent to tests/concurrency to harmonize with other concurrency directory names

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[1950837]1#include <actor.hfa>
2#include <fstream.hfa>
3#include <stdlib.hfa>
4#include <string.h>
5#include <stdio.h>
6#include <mutex_stmt.hfa>
7
8struct Server { inline actor; };
9struct Server2 { inline Server; int b; };
10struct D_msg { int a; inline message; };
11struct D_msg2 { inline D_msg; };
12
13void ^?{}( Server2 & this ) { mutex(sout) sout | 'A'; }
14void ?{}( D_msg & this ) { set_allocation( this, Delete ); }
15void ^?{}( D_msg & this ) { mutex(sout) sout | 'A'; }
16
17Allocation handle() {
18    return Finished;
19}
20
21Allocation receive( Server & receiver, D_msg & msg ) { return handle(); }
22Allocation receive( Server & receiver, D_msg2 & msg ) { return handle(); }
23Allocation receive( Server2 & receiver, D_msg & msg ) { return Delete; }
24Allocation receive( Server2 & receiver, D_msg2 & msg ) { return Delete; }
25
26int main() {
27    sout | "Start";
28    {
29        start_actor_system();
30        D_msg * dm = alloc();
31        (*dm){};
32        D_msg2 dm2;
33        Server2 * s = alloc();
34        (*s){};
35        Server2 * s2 = alloc();
36        (*s2){};
37        *s << *dm;
38        *s2 << dm2;
39        stop_actor_system();
40    }
41    {
42        start_actor_system();
43        Server s[2];
44        D_msg * dm = alloc();
45        (*dm){};
46        D_msg2 dm2;
47        s[0] << *dm;
48        s[1] << dm2;
49        stop_actor_system();
50    }
51    sout | "Finished";
52}
Note: See TracBrowser for help on using the repository browser.