Esempio n. 1
0
        public void release(philosopher owner, CancellationToken cancellation, Action <object> success, Action <Exception> failure)
        {
            var __success      = success;
            var __failure      = failure;
            var __cancellation = cancellation;

            __enter(() => __advance(__concurrentrelease(owner, __cancellation, __success, __failure).GetEnumerator()), failure);
        }
Esempio n. 2
0
        public Task <object> release(philosopher owner, CancellationToken cancellation)
        {
            var                completion     = new TaskCompletionSource <object>();
            Action <object>    __success      = (__res) => completion.SetResult((object)__res);
            Action <Exception> __failure      = (__ex) => completion.SetException(__ex);
            var                __cancellation = cancellation;

            __enter(() => __advance(__concurrentrelease(owner, __cancellation, __success, __failure).GetEnumerator()), __failure);
            return(completion.Task);
        }
Esempio n. 3
0
 private IEnumerable <Expression> __concurrentrelease(philosopher owner, CancellationToken __cancellation, Action <object> __success, Action <Exception> __failure)
 {
     if (_owner != owner)
     {
         throw new ArgumentException();
     }
     _owner = null;
     {
         __dispatch("release");
         if (__success != null)
         {
             __success(null);
         }
         yield break;
     }
 }
Esempio n. 4
0
        private IEnumerable <Expression> __concurrentacquire(philosopher owner, CancellationToken __cancellation, Action <object> __success, Action <Exception> __failure)
        {
            if (_owner != null)
            {
                {
                    var __expr5_var = new __expr5 {
                        Start = (___expr) =>
                        {
                            var __expr = (__expr5)___expr;
                            __listen("release", () =>
                            {
                                __expr.__op6(true, null, null);
                            }

                                     );
                            __expr.__op6(null, false, null);
                        }

                        , End = (__expr) =>
                        {
                            __enter(() => __advance(__expr.Continuator), __failure);
                        }
                    };
                    yield return(__expr5_var);

                    if (__expr5_var.Failure != null)
                    {
                        throw __expr5_var.Failure;
                    }
                }
            }

            _owner = owner;
            {
                __dispatch("acquire");
                if (__success != null)
                {
                    __success(null);
                }
                yield break;
            }
        }
Esempio n. 5
0
 public void release(philosopher owner)
 {
     release(owner, default(CancellationToken), null, null);
 }
Esempio n. 6
0
 public void acquire(philosopher owner)
 {
     acquire(owner, default(CancellationToken), null, null);
 }