Esempio n. 1
0
            internal override void TryAlt(ref Worker wr, int i, Cont <X> xK, Else xE)
            {
                var pk = xE.pk;

                if (0 == Pick.Claim(pk))
                {
                    Alt <X> xA;
                    try {
                        xA = Do(Randomizer.Next(ref wr.RandomLo, ref wr.RandomHi));
                        Pick.Unclaim(pk);
                    } catch (Exception e) {
                        Pick.PickClaimedAndSetNacks(ref wr, i, pk);
                        xA = new AltFail <X>(e);
                    }
                    xA.TryAlt(ref wr, i, xK, xE);
                }
            }
Esempio n. 2
0
            internal override void TryAlt(ref Worker wr, int i, Cont <X> xK, Else xE)
            {
                var pk = xE.pk;
                var nk = Pick.ClaimAndAddNack(pk, i);

                if (null != nk)
                {
                    Alt <X> xA;
                    try {
                        xA = Do(nk);
                        Pick.Unclaim(pk);
                    } catch (Exception e) {
                        Pick.PickClaimedAndSetNacks(ref wr, i, pk);
                        xA = new AltFail <X>(e);
                    }
                    xA.TryAlt(ref wr, i, xK, new WithNackElse(nk, xE));
                }
            }