|
1 namespace mozilla { |
|
2 namespace _ipdltest { |
|
3 |
|
4 intr protocol PTestInterruptRaces { |
|
5 both: |
|
6 intr Race() returns (bool hasReply); |
|
7 intr StackFrame() returns (); |
|
8 intr StackFrame3() returns (); |
|
9 |
|
10 parent: |
|
11 sync StartRace(); |
|
12 intr Parent(); |
|
13 sync GetAnsweredParent() returns (bool answeredParent); |
|
14 |
|
15 child: |
|
16 Start(); |
|
17 Wakeup(); |
|
18 Wakeup3(); |
|
19 intr Child(); |
|
20 __delete__(); |
|
21 |
|
22 state START: |
|
23 send Start goto TEST1; |
|
24 |
|
25 // First test: race while no other messages are on the Interrupt stack |
|
26 state TEST1: |
|
27 recv StartRace goto RACE1; |
|
28 state RACE1: |
|
29 call Race goto DUMMY1_1; |
|
30 answer Race goto DUMMY1_2; |
|
31 state DUMMY1_1: |
|
32 answer Race goto TEST2; |
|
33 state DUMMY1_2: |
|
34 call Race goto TEST2; |
|
35 |
|
36 // Second test: race while other messages are on the Interrupt stack |
|
37 state TEST2: |
|
38 call StackFrame goto MORESTACK; |
|
39 state MORESTACK: |
|
40 answer StackFrame goto STARTRACE; |
|
41 state STARTRACE: |
|
42 send Wakeup goto RACE2; |
|
43 state RACE2: |
|
44 call Race goto DUMMY2_1; |
|
45 answer Race goto DUMMY2_2; |
|
46 state DUMMY2_1: |
|
47 answer Race goto TEST3; |
|
48 state DUMMY2_2: |
|
49 call Race goto TEST3; |
|
50 |
|
51 // Third test: resolve race using custom policy |
|
52 state TEST3: |
|
53 call StackFrame3 goto MORESTACK3; |
|
54 state MORESTACK3: |
|
55 answer StackFrame3 goto STARTRACE3; |
|
56 state STARTRACE3: |
|
57 send Wakeup3 goto RACE3; |
|
58 state RACE3: |
|
59 call Child goto DUMMY3_1; |
|
60 answer Parent goto DUMMY3_2; |
|
61 state DUMMY3_1: |
|
62 // the parent receives this from the child in this state |
|
63 recv GetAnsweredParent goto CHECK; |
|
64 // this transition is never taken (if the custom race resolution |
|
65 // works correctly) |
|
66 answer Parent goto CHECK; |
|
67 state DUMMY3_2: |
|
68 call Child goto CHECK; |
|
69 state CHECK: |
|
70 // the child sends this from this state |
|
71 recv GetAnsweredParent goto DYING; |
|
72 // because of deferred processing, the parent receives the child's |
|
73 // message here |
|
74 answer Parent goto DYING; |
|
75 |
|
76 |
|
77 state DYING: |
|
78 send __delete__; |
|
79 }; |
|
80 |
|
81 } // namespace _ipdltest |
|
82 } // namespace mozilla |