source: tests/concurrent/actors/inherit.cfa@ bb7422a

ADT ast-experimental
Last change on this file since bb7422a was 1950837, checked in by caparsons <caparson@…>, 3 years ago

added virtual dtor test to actor test suite, updated other relevant tests accordingly

  • Property mode set to 100644
File size: 1.3 KB
Line 
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.