ast-experimental
Last change
on this file since 8463136 was
1950837,
checked in by caparsons <caparson@…>, 18 months ago
|
added virtual dtor test to actor test suite, updated other relevant tests accordingly
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[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 | |
---|
| 8 | struct Server { inline actor; }; |
---|
| 9 | struct Server2 { inline Server; int b; }; |
---|
| 10 | struct D_msg { int a; inline message; }; |
---|
| 11 | struct D_msg2 { inline D_msg; }; |
---|
| 12 | |
---|
| 13 | void ^?{}( Server2 & this ) { mutex(sout) sout | 'A'; } |
---|
| 14 | void ?{}( D_msg & this ) { set_allocation( this, Delete ); } |
---|
| 15 | void ^?{}( D_msg & this ) { mutex(sout) sout | 'A'; } |
---|
| 16 | |
---|
| 17 | Allocation handle() { |
---|
| 18 | return Finished; |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | Allocation receive( Server & receiver, D_msg & msg ) { return handle(); } |
---|
| 22 | Allocation receive( Server & receiver, D_msg2 & msg ) { return handle(); } |
---|
| 23 | Allocation receive( Server2 & receiver, D_msg & msg ) { return Delete; } |
---|
| 24 | Allocation receive( Server2 & receiver, D_msg2 & msg ) { return Delete; } |
---|
| 25 | |
---|
| 26 | int 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.