1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/ipdl/test/cxx/PTestRaceDeferral.ipdl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,45 @@ 1.4 +namespace mozilla { 1.5 +namespace _ipdltest { 1.6 + 1.7 +intr protocol PTestRaceDeferral { 1.8 +parent: 1.9 + intr Lose(); 1.10 + 1.11 +child: 1.12 + async StartRace(); 1.13 + intr Win(); 1.14 + intr Rpc(); 1.15 + async __delete__(); 1.16 + 1.17 +// Test that messages deferred due to race resolution are 1.18 +// re-considered when the winner makes later RPCs 1.19 + 1.20 +// IPDL's type system can't express this protocol because the race 1.21 +// resolution causes state to diverge for multiple steps, so we'll 1.22 +// leave it "stateless" 1.23 +/* 1.24 +state START: 1.25 + send StartRace goto DEFER; 1.26 +state DEFER: 1.27 + call Win goto PARENT; 1.28 + answer Lose goto CHILD; 1.29 + 1.30 +state PARENT: 1.31 + // 'Lose' is received here but deferred 1.32 + call Rpc goto PARENT_LOSE; 1.33 +state PARENT_LOSE: 1.34 + // Calling 'Rpc' undefers 'Lose', and it wins the "race" with 'Rpc' 1.35 + answer Lose goto DONE; 1.36 + 1.37 +state CHILD: 1.38 + call Win goto CHILD_RPC; 1.39 +state CHILD_RPC: 1.40 + call Rpc goto DONE; 1.41 + 1.42 +state DONE: 1.43 + send __delete__; 1.44 +*/ 1.45 +}; 1.46 + 1.47 +} // namespace _ipdltest 1.48 +} // namespace mozilla