declare fun {WaitTwo A B} X in thread {Wait A} try X=1 catch _ then skip end end thread {Wait B} try X=2 catch _ then skip end end X end