source: tests/concurrency/actors/poison.cfa @ d3cf623

Last change on this file since d3cf623 was 41882628, checked in by Peter A. Buhr <pabuhr@…>, 2 months ago

update test programs with actor name change

  • Property mode set to 100644
File size: 754 bytes
Line 
1#include <actor.hfa>
2#include <fstream.hfa>
3#include <stdlib.hfa>
4#include <string.h>
5#include <stdio.h>
6
7struct Server { int val; inline actor; };
8
9void ?{}( Server & this ) { this.val = 999; }
10void ^?{}( Server & this ) { this.val = 777; }
11
12int main() {
13        sout | "Start";
14
15        sout | "Finished";
16        {
17                actor_start();
18                Server s[10];
19                for ( i; 10 ) {
20                        s[i] | finished_msg;
21                }
22                actor_stop();
23        }
24
25        sout | "Delete";
26        {
27                actor_start();
28                for ( i; 10 ) {
29                        Server * s = alloc();
30                        (*s){};
31                        (*s) | delete_msg;
32                }
33                actor_stop();
34        }
35
36        sout | "Destroy";
37        {
38                actor_start();
39                Server s[10];
40                for ( i; 10 )
41                        s[i] | destroy_msg;
42                actor_stop();
43                for ( i; 10 )
44                        if (s[i].val != 777)
45                                sout | "Error: dtor not called correctly.";
46        }
47
48        sout | "Done";
49}
Note: See TracBrowser for help on using the repository browser.