michael@0: namespace mozilla { michael@0: namespace _ipdltest { michael@0: michael@0: intr protocol PTestInterruptRaces { michael@0: both: michael@0: intr Race() returns (bool hasReply); michael@0: intr StackFrame() returns (); michael@0: intr StackFrame3() returns (); michael@0: michael@0: parent: michael@0: sync StartRace(); michael@0: intr Parent(); michael@0: sync GetAnsweredParent() returns (bool answeredParent); michael@0: michael@0: child: michael@0: Start(); michael@0: Wakeup(); michael@0: Wakeup3(); michael@0: intr Child(); michael@0: __delete__(); michael@0: michael@0: state START: michael@0: send Start goto TEST1; michael@0: michael@0: // First test: race while no other messages are on the Interrupt stack michael@0: state TEST1: michael@0: recv StartRace goto RACE1; michael@0: state RACE1: michael@0: call Race goto DUMMY1_1; michael@0: answer Race goto DUMMY1_2; michael@0: state DUMMY1_1: michael@0: answer Race goto TEST2; michael@0: state DUMMY1_2: michael@0: call Race goto TEST2; michael@0: michael@0: // Second test: race while other messages are on the Interrupt stack michael@0: state TEST2: michael@0: call StackFrame goto MORESTACK; michael@0: state MORESTACK: michael@0: answer StackFrame goto STARTRACE; michael@0: state STARTRACE: michael@0: send Wakeup goto RACE2; michael@0: state RACE2: michael@0: call Race goto DUMMY2_1; michael@0: answer Race goto DUMMY2_2; michael@0: state DUMMY2_1: michael@0: answer Race goto TEST3; michael@0: state DUMMY2_2: michael@0: call Race goto TEST3; michael@0: michael@0: // Third test: resolve race using custom policy michael@0: state TEST3: michael@0: call StackFrame3 goto MORESTACK3; michael@0: state MORESTACK3: michael@0: answer StackFrame3 goto STARTRACE3; michael@0: state STARTRACE3: michael@0: send Wakeup3 goto RACE3; michael@0: state RACE3: michael@0: call Child goto DUMMY3_1; michael@0: answer Parent goto DUMMY3_2; michael@0: state DUMMY3_1: michael@0: // the parent receives this from the child in this state michael@0: recv GetAnsweredParent goto CHECK; michael@0: // this transition is never taken (if the custom race resolution michael@0: // works correctly) michael@0: answer Parent goto CHECK; michael@0: state DUMMY3_2: michael@0: call Child goto CHECK; michael@0: state CHECK: michael@0: // the child sends this from this state michael@0: recv GetAnsweredParent goto DYING; michael@0: // because of deferred processing, the parent receives the child's michael@0: // message here michael@0: answer Parent goto DYING; michael@0: michael@0: michael@0: state DYING: michael@0: send __delete__; michael@0: }; michael@0: michael@0: } // namespace _ipdltest michael@0: } // namespace mozilla